May 19, 2014

The Correct File Permissions For Wordpress in Ubuntu

At my company we use Wordpress as a pretty front-end to our custom home-grown applications. The reason we do this is so that the Marketing team can easily update the website without the need of a developer.

We run Wordpress ourselves using Ubuntu Linux, and I ofter hear people complain that there is a message in the admin dashboard that says stuff like "Please make sure your .htaccess file is writable" or if someone wants to add a plugin, they are prompted for FTP information.

To fix all of that I just set the correct permissions in the directory where our Wordpress files are located. Let's say we keep them in /var/www, to set the correct permissions you would run:

sudo chmod 744 /var/www/ -R
Then you would make sure the Apache2 user had ownership by running:
sudo chown -R www-data:www-data /var/www
If you have an FTP user account that you like to use that needs write access to to your Worpress installation files, then these permissions won't work. What you will need to do is add your user to the www-data group by running:
sudo useradd -g www-data username
Then you will want to modify the permissions like you did above, but this time we will also give full access to the www-data group by changing 744 to 774:
 sudo chmod 774 /var/www/ -R
That's it! Now your users will be able to install plugins, perform Wordpress upgrades etc. without any issues, and if you use FTP users, they will be able to make the necessary edits they need!
Enhanced by Zemanta

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam