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

Our sysadmin quit and I have been handed "the ropes." Unfortunately, I don't know how to climb very well.

Here is my problem.

We have 4 servers that we use for our hosting of client's sites. Anyway.

I'm trying to upload a file to this certain client's directory via sftp. Getting permission denied. I have sudo access to everything, and I discovered this folder and it's files were owned by an ex employee.

To change that I ran

sudo chown -R www-data public_html/

which made www-data owner of the directory and the sub files.

According to /etc/group I am in the group of www-data as well as our developers.

However, I am not able to upload/overwrite files. When I go and change the owner -R to shutter (me) and all the files, I still cannot upload.

What am I doing wrong?

share|improve this question
What error message are you getting ? – Iain Feb 14 '12 at 16:59
Error: /var/www/ open for write: permission denied Error: File transfer failed – Brandon Shutter Feb 14 '12 at 17:12
up vote 1 down vote accepted

First of all, don't try uploading straight into a web folder. I would recommend uploading to your home folder, doing the necessary permission changes THEN copying(NOT moving) the files to that destination(will probably require sudo). That should do it.

share|improve this answer
I realize that this does it. But here's another question. What if I have hundreds of files to upload. My devs don't have sudo access. It would be a hinder to their productivity (and mine) to have them ask me to sudo cp files over. – Brandon Shutter Feb 14 '12 at 17:05
It may 'hinder' their productivity but there are certain ways of doing things in a production environment. Sftping into a production web folder can have some nasty consequences if you have a brain fart. As such, best practice dictates you dump the files into a neutral location THEN copy them over. If best practices are not much of a concern then I'm kind of at a loss on how to help as I don't work that way :P – Publiccert Feb 14 '12 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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