I'm running an Ubuntu 14.04.1 LTS server on Digital Ocean. I'm trying to make it so I can edit files in /srv/www from my normal user account, without needing to be root.
Currently, /srv/www is owned by www-data:www-data:
sudo chown -R www-data:www-data /srv/www
I've also set the permissions on all files to 664, and on directories to 755:
sudo find /srv/www/ -type f -exec sudo chmod 644 {} \;
sudo find /srv/www/ -type d -exec sudo chmod 755 {} \;
And I added my user, shea, to the www-data group:
sudo adduser shea www-data
However, when I try to touch /srv/www/foo, I receive the following error:
touch: cannot touch ‘/srv/www/foo’: Permission denied
It works fine if I prepend sudo to that command, but I'd rather not do that all the time; plus it doesn't work over SFTP.
Changing the owner to shea:www-data allows me to write to the files, but then WordPress cannot update plugins and themes.
sudo chown -R shea:www-data /srv/www
Is there anyway that www-data and shea users can both have access to /srv/www? I was under the impression that adding both users to a group would do the trick, but I can't seem to get it working.