If I understand your setup correctly, run the following commands. But make sure:
- You’re running them as “god”, not “magento2” user
- You’re in
/var/www/html/
Set Ownership
sudo chown -R magento2:www-data /var/www/html/
Set Permissions
sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + && chmod u+x bin/magento
Ref: How to diagnose and fix Ownerships and Permission issues