What permissions do I need to have on my WordPress site?

We need to write to your WordPress site to import updated files from the staging site, and because WP Stagecoach is a plugin, the only way we can interact with your site is through the web server. A lot of shared hosting sites make sites that run on PHP (like WordPress) run as their individual user, so the web server has full write access to the WP site and we can import files without a problem.

However, on dedicated servers things are usually not set up this way: you will have Apache (or possibly NGINX) running as a particular user (usually apache or nginx respectively) and that user does not necessarily have full write access to your WordPress site. To let the web server have full write access to your site, you will need to break out the command line and run a few commands.

(If you know what the username your web server is running as, you can skip this step). First, we need to determine what web server you are running, and what username it is running as. Typing the following command into the command line on your server will report what user your web server is running as:

ps aux | egrep 'httpd$|nginx$' | egrep -v 'grep|root' | awk '{print $1}' | sort | uniq

Then you will need to change the group ownership of your WP site to this user. You will (most likely) have to run this as the superuser (root). To do this, run the following command (substituting the info in [] with your own information):

cd </path/to/your/WP/site/>
sudo chgrp -R [your webserver username gotten from the first command] .  # don't forget the last dot '.'!
sudo chmod -R g+w

That should grant the web server full write access to your WP site, and you should be able to update with WP Stagecoach!

Letting your web server have full write access isn’t the most secure thing you can do, so to revert your changes, you will need to run the following commands to determine who currently owns the WP site (most likely your own user or root), and remove the web server’s write access to it:

cd [/path/to/your/WP/site/]
ls -ld . | awk '{print $3}'  # this is the username you want to use below
sudo chgrp -R [username from above] .

Related Articles