Linux Permissions Issue (Can't Upload)

Computer Guy
Computer Guy used Ask the Experts™
My user is tom.

my folder structure is setup like such:


/var/www/domain1 are set as root:root.
public_html is set to www-data:www-data

I added my user tom to www-data (and did login/logoff)

When I attempt to upload to public_html, I get an access denied error.

What do I need to do to upload to this folder?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Systems Administrator
Check and verify that the www-data group has write permissions to the public_html folder.  You can view the current permissions on the files and folders by using the "ls -l" command.

It should look like this:
drwxrwxr-x   root   www-data   public_html


Currently is is set to:

drwxr-xr-x  www-data www-data public_html

What permission number is drwxrwxr-x
Top Expert 2015

You dont want any writable file in web-reachable place.
Suhosin,selinux and apparmor are all well trained against such files.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


In this case I am in the middle of uploading some files locally to server via sftp. Is there a better way in this case?
Top Expert 2015

If you have huge collection of files rsync is better, but you are close to perfection.
RobertSystems Administrator

You can use chmod to change permissions:

chmod 775 on the directory will give user and group full permissions, while everyone else is given only read and execute.

To apply this change recursively, you can to the following:

cd /var/www/ && chmod -R 775 public_html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial