Linux Permissions Issue (Can't Upload)

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?
Computer GuyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobertSystems AdministratorCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Computer GuyAuthor Commented:
Currently is is set to:

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

What permission number is drwxrwxr-x
You dont want any writable file in web-reachable place.
Suhosin,selinux and apparmor are all well trained against such files.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Computer GuyAuthor Commented:
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?
If you have huge collection of files rsync is better, but you are close to perfection.
RobertSystems AdministratorCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.