Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my WordPress site newly hosted on a small Linux box with Nginx. Nginx runs as the user www-data just like apache, so I have the entire public_html directory owned by www-data so that WordPress can upload media files, install new plugins, etc.

My question is how can I setup the public_html directory so that a user logged in via SFTP can upload or edit files? I tried doing

chown -R myUserName:www-data public_html 

but that didn't work.

share|improve this question

closed as off-topic by Jenny D, Ward, Dave M, mdpc, Falcon Momot Oct 8 '13 at 5:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Jenny D, Ward, Dave M, mdpc, Falcon Momot
If this question can be reworded to fit the rules in the help center, please edit the question.

What does "didn't work" mean? – Michael Hampton Dec 2 '12 at 18:36
It still wasn't writable by the server anymore, only the user. – WebDevDude Dec 2 '12 at 18:42
You might want to look at the answers for this question. – Nic Dec 3 '12 at 5:34

One thing is setting the owner and group - but you need to define whether or not the user and/or group can write.

This will do what you are asking

find /path/to/public_html -type d -exec chmod 775 {} \;
find /path/to/public_html -type f -exec chmod 664 {} \;

However, you don't want your webserver to be able to write to everything on a Wordpress installation.

You want to figure out exactly what directories you need to be writable by reading the Wordpress hardening guide

If you do not do this, rest assured that your site will be hacked at some point. Not necessarily defaced or changed, but attackers often just use a little space on your site to store a phishing page - which can be a pain to fix.

share|improve this answer
If the server is not writable to the WordPress install directory, then automatic updates will never work. I had already set the permissions on file, but this changes nothing. – WebDevDude Dec 2 '12 at 20:23
Those commands will set all files and folders to be writable by user and group. And the group is www-data as you set with your chown, thus giving www-data write access to the files. – Frands Hansen Dec 2 '12 at 21:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.