Access denied edit files via SFTP on Ubuntu after upload via Wordpress

2

I have an Ubuntu VPS (LAMP) and I manage the PHP files from the www folder via SFTP.

I use Wordpress on my server, with it I upload folders and files and also delete them. Via Wordpress when I do a new upload of a folder or file and later try to delete or edit the contents of some file directly via SFTP the server returns me access denied. If I send the file or folder directly via SFTP the server allows without problems.

Every time I upload a folder or file via Wordpress and need to manually change the folder or files via SFTP, I need to run the following command for the server to not return access denied:

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

Why does this happen? I configured permissions incorrectly? When I use Wordpress to upload, does it generate the folder and files with different permissions?

    
asked by anonymous 28.11.2014 / 15:46

1 answer

1

This is because your Apache is run by the user www-data and you are accessing ftp by another user. So they are different users and one is not allowed to change the other's file.

You can add your user (used in ftp) to the same user group www-data and leave the permissions as 775 and 664 instead of 755 and 664, as they usually are. This allows writing for the whole group.

See more about chmod and permissions here: link

    
30.12.2014 / 21:07