vespino
vespino

Reputation: 1940

correct rights linux webserver

I have installed a LAMP server (Ubuntu) on a VPS and everything seems to be running fine. After uploading and installing WordPress I ran into a couple of rights issues (not being able to upload, not being able to create/change the .htaccess file from within WordPress, the usual) so I chmod the directory so the www-data user is owner:

sudo chown -R www-data:www-data /var/www/domain.com/public_html/

Now all of the above works fine, but...

When I upload a file or directory the owner/group is set to the user I'm using to "FTP" with. This results in WordPress not being able to update the files (e.g. a plugin). The user I'm using for FTP transfer is part of the www-data group.

What should/can I do to prevent this and thus automagically add the www-data owner/group to uploaded files? And is this the way to go?

Upvotes: 0

Views: 45

Answers (1)

vespino
vespino

Reputation: 1940

Think I found it: https://help.ubuntu.com/lts/serverguide/httpd.html

Sharing Write Permission

sudo chgrp -R www-data /var/www/domain.com

sudo find /var/www/domain.com -type d -exec chmod g=rwxs "{}" \;

sudo find /var/www/domain.com -type f -exec chmod g=rw "{}" \;

Upvotes: 0

Related Questions