FTP Apache permissions

Posted February 12, 2014 8.3k views
very basic question: I have apache set up on a ubuntu droplet. created a newuser, gave him root access. when I log in as newuser through ssh/sftp I need to be able to upload files to /var/www but I dont have permission. How would I give newuser permission to upload and delete from that folder so I can actually put web pages up?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
6 answers
How did you give him root access ?

Anyway, a better option can be changing ownership of the files in /var/www to the yourself : apache and adding the user to the apache group. Then permissions of 775 on the folder will give user the proper read write permissions.
There is no point of giving a user the root privileges, but to increase the risk to get your web server hacked easily...

you need to give a user some privileges so that if the user got hacked, it is still safe to avoid high risk of breaking into your server.

for what you are up to, read this and be careful when giving permission to user:

so what I have now is:
1. root user. not used
2. admin account with root privileges. this is the main account i will use to admin tasks
3. web account which I have assigned to the www-data group and given him/the group permission to read/write to /var/www. this is the main account i will use to do ftp tasks

is this typically how user accounts are structured on servers? very new to webservers so still trying to figure out the correct things to do
That looks proper :] You might want to use sftp instead of ftp as it is much more secure:
by Pablo Carranza
This article will teach you how to use Filezilla to transfer and manage files securely on your VPS.
would you add the admin account to the www-data group? or is that not necessary/recommended?

and yes, i do use sftp
You can do that, it shouldn't cause any issues.