Clarification please: write permissions /usr/share/nginx/www

December 15, 2013 12.8k views
Hi I get so frustrated with the lack of my knowledge ;) I'm setting up a new droplet. Nginx is installed and the "Welcome to nginx!" shows in the browser. PHP is also working as well as mysql and phpmyadmin. Now, I connected sftp using filezilla with a username and tried to upload a file. The file would not upload and the error: Error: /usr/share/nginx/www/installer.php: open for write: permission denied Now this makes sense because root is the owner. I recall issues (and did searches) that WordPress will not update unless the correct ownership is provided. Sadly, answers are a bit cryptic. I tried: chgrp www-data /usr/share/nginx/www chmod g+w /usr/share/nginx/www This did not work. Also, I know that there must be a way to add permissions to the "myuser" account so that I can transfer files AND have WordPress update. Thank you for the clarification.
4 Answers
Your user does not have access to write to /usr/share/nginx/www.

You also shouldn't store your websites in /usr/share/nginx/www. Instead, store them in /var/www and edit nginx to serve the files from that directory:
sudo mkdir /var/www

sudo chown wordpress. /var/www
mv /usr/share/nginx/www/* /var/www
mv /usr/share/nginx/www/.* /var/www

Add your user to the wordpress group:
sudo usermod -a -G wordpress youruser

Then allow group write to /var/www:
sudo chgrp -R wordpress /var/www

sudo chmod -R g+w /var/www
Thank you but I have a couple of questions for clarification.

First, there is no "wordpress" user or group. I temporarily used www-data.

Second, I moved the files to /var/www and updated the nginx config file.

I'm still not able to update WordPress in wp-admin panel. :(
What user is php5-fpm running as?
sudo ps wwaux | grep php5-fpm

Hi Kamal,
Hope you can help me, I have the same problem I don't have writing permissions to update some files on wordpress using Winscp, I've followed this tutorial to install wordpress "" and works fine.
I've installed wordpress under "/usr/share/nginx/wpdir", when I try to run as you mention "sudo usermod -a -G wpdir myuser" I get the message "group 'wpdir' does not exist".

I have no user root instead I've created a new user "myuser" with sudo rights following this tutorial:

I have another question: why it is important to move wordpress from: "/usr/share/nginx/wpdir" to "/var/www"


by Justin Ellingwood
When you start a new server, there are a few steps that you should take every time to add some basic security and give you a solid foundation. In this guide, we'll walk you through the basic steps necessary to hit the ground running with Ubuntu 14.04.
Have another answer? Share your knowledge.