Hey all,
Currently I’m running a Wordpress multisite configuration. Here I’ve recursively set www-data as the owner of /var/www to allow Wordpress write access in it’s whole installation. All folders within /var/www have their permissions set to 755. Now I’d like to still connect to my server using SFTP to add/edit/delete files using another (sudo) user, which isn’t possible.
What would be presumed best practice to solve this problem? Thanks in advance! Lorenzo
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
you can add your (sudo) user to the same group as www-data and then add read/write/execute permissions to the directory (775) for this group. Something like this: http://serverfault.com/a/65416
Hi,
you can create a new group
groupadd www-pub
add your (sudo) user and www-data to this group
usermod -a -G www-pub www-data
usermod -a -G www-pub username
change directory owner
chown -R www-data:www-pub /var/www
change permissions for the directory
chmod 2775 /var/www
the “prefix” 2 is a Set group ID bit, which causes the group to be copied to all new files and folders created in that folder. This does not work recursively, so you need to set it for existing folders manually
find /var/www -type d -exec chmod 2775 {} + # set directories to 2775
find /var/www -type f -exec chmod 0664 {} + # set files to 0664
It works and allows you to create a file and all files created there from FTP is with username:www-pub but even after placing that file not allows you delete that file as in this case again it shows permission denied.
Any Suggestions
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.