Hey I think I got everything fixed. I’m fixing to do a reboot to double check but I wanted to log some quick notes here for anyone else who might have this or a similar problem in the future.
In order to do this I first added david to the www-data usegroup and added www-data to the david usergroup.
This might be a little bit of a security issue but I really don’t think it’s that major.
Secondly I needed to change the umask for www-data, so that when it created a new file in the folder it would do so with a 775 permission (meaning that user and groups would have full write, read, execute access).
This can be done on my nginx server by doing the thing describerd here: ubuntu - Nginx/php-fpm umask setting - Stack Overflow
if you use systemd [i.e. Ubuntu 16.04], then edit /lib/systemd/system/php5-fpm.service
And edit chapter “Service”:
[Service]
UMask=0002
In my case I edited php-fpm 7.2 because that’s the version I’m using.
Okay so now www-data will create new folders on the system that can be opened by the groups etc.
But the next thing to do is to make it so that files made by the user are editable to the www-data. The way to do that is to change the umask for david. It’s enough to just add the line umask 002
somewhere in your .bashrc or .profile file. If you want to you can also add it to your root user account in a similar way.
This still isnt’ enough though because as mactrent said, nautilus etc are going to have their own default umasks to use when you create folders etc with them. According to this post it is possible like this: gnome3 - How to set `umask` for the entire gnome session? - Unix & Linux Stack Exchange
up vote 2 down vote
The problem is that mentioned by Sebasth. I tried many things, but then i found a workaround which consists in overwriting the (per-user) UMask of dbus:
$ systemctl --user edit dbus
In the file that gets opened, just write:
[Service]
UMask=002 # This is the umask i want to use
The file gets saved in .config/systemd/user/dbus.service.d/override.conf and overrides the dbus default umask, which i presume is inherited from systemd --user, since dbus is launched by it. Just logout and login again and gnome applications should use the specified umask. It works form me.
I’m going to restart my machine and see if it works but I think it should.