Sharing Write Permission
For more than one user to be able to write to the same directory it will be necessary to grant write permission to a group they share in common. The following example grants shared write permission to /var/www/html to the group “webmasters”
I use www-data. Just replace “webmasters” with your group, be sure you add the user to the group of course.
sudo chgrp -R webmasters /var/www/html
sudo find /var/www/html -type d -exec chmod g=rwxs “{}” \;
sudo find /var/www/html -type f -exec chmod g=rws “{}” \;
I just tested it with Dreamweaver from my mac desktop and uploaded and replaced files added files etc and it retains the correct permissions with one exception, the local user becomes owner of new files along with www-data, but any files created by root in the html directory retain their ownership as root but are editable by local user.
$ls -l
$-rw-rw-r– 1 localUser www-data 11505 May 28 09:56 index2.html
$-rw-rwSr– 1 root www-data 11535 May 28 09:58 index.html
Hope this clears up things and helps the weary, cause I know I was always weary of this situation, but now it is clear to me.
Oh and I highly recommend using sftp with keys to access your ftp, works great for me and don’t need PureFTP or any other insecure method of delivering the files to the website. There’s a good few tutorials on Digital Ocean site all about securing your server with ssh keys: