SFTP / Wordpress Permissions

July 26, 2015 1.3k views

It seems this question has come up quite a bit before, but I wasn't able to find a working solution.

Installation: Ubuntu WordPress on 14.04

The problem I originally had was when I tried to upload a plugin for my Wordpress site through SFTP (FileZilla) using [userName] I received an error saying Permission Denied. I followed the responses from similar questions and did as suggested

sudo usermod -a -G www-data [userName]
sudo chmod -R g+w /var/www/

And was then able to upload files. However, when I went on to Wordpress and tried to update the new plugin, I was met there with a Permission Denied.

If I view the plugin folder within FileZilla I can see the Owner/Group is "[userName] [userName]" as opposed to www-data www-data as with everything else. I saw comments on other questions providing manual steps one could take to change permissions for the specific file, but I was wondering if there was a permanent solution as logging into the console and manually changing permissions every time could become tedious.

2 Answers

Hi Xugo,

I recommend the following page from Wordpress, which will give you a best practice idea.

  • Hey Jay,

    Sorry, the only applicable suggestion I could pull from that article was setting permissions for folders to 775 instead of 755 and 664 for files instead of 644. However, that is the current setting.

    I think the problem is by default uploads with my user account trouble FileZilla are classified as belonging to the [userName] group instead of www-data, which the user should also be a part of. Is there a way to change this?

Have another answer? Share your knowledge.