2

I've created a user 'www' and added it to the 'www-data' group. I've set the home directory of 'www' to /var/www/ also. I would like to use 'www' to transfer files in and out of my web server by FTP

The problem is when I run the command:

sudo chown -R www-data:www-data /var/www/

..I don't have permission to write files via FTP

However when I run:

sudo chown -R www:www /var/www

..I have full FTP access but get a 'Forbidden' message in my browser.

Any advice on how to get full FTP access including all subfolders would be really appreciated.

1

That means that you already have a www-data user which Apache uses that should have the necessary permissions in /var/www.

The simplest solution would be to use that same user, but you could also assign the www-data group to your new user and make sure the /var/www directory structure allows the group to write to it:

chown -R www-data:www-data /var/www
chmod -R ug+rw /var/www
  • 'chmod -R ug+rw /var/www' did the trick. You've saved me a massive headache. Thanks a lot for your help. – Cayman Roe Aug 17 '16 at 20:09
  • Sorry to bother you again, I've found out that PHP files are returning a HTTP 500 error code. 'Permission denied' in apache logs. HTML files are fine.. just PHP. Any ideas? – Cayman Roe Aug 21 '16 at 0:31
  • Maybe the directories holding them don't give +x to the Apache user. – Julie Pelletier Aug 21 '16 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.