I have a CentOS 7 VM setup on my Windows 7 host.

I have installed vsftpd and ftp and can now successfully connect from the host with FileZilla, but the user I log in as doesn't have permissions to write to /var/www/html and so I cannot upload files there. /var/www/html is owned by user:root and group:root.

I know I shouldn't add my user to the root group. Instead, should I change the group which owns the directory to another (e.g. make one like www-admins) and add my user to that group? I am fairly new to linux and so am wary about changing permissions on directories...


Normally the webserver user owns that directory. If you're using apache2 then usually its www-data user/group that owns them.

To check which user is running apache2 u can use:

sudo ps aux | grep apache[2]

Or if you dont use sudo, u can use:

ps aux | grep apache[2]

You may have 1 process that root runs, but the rest should be the apache2 user.

To change the owner and group of the files u can use:

sudo chown -R apache2_user:apache2_user

Where apache2_user is the user that you got from the ps command above. Then you can add yourself to that group to gain access. Note that if you dont use sudo, u can use su to gain root so u can chown the directory and files. eg.

chown -R apache2_user:apache2_user
  • The folders I am interested in are owned by apache (user and group). I've added my user to the apache group but that is not enough - only the apache user has write permissions - the group only has read and execute. Should I add write permissions to those folders for the apache group too or this that a bad idea? – Kvothe Jul 14 '15 at 15:11
  • The apache group should have read and execute as well as other. There are some files that should not have read execute for other, but perhaps you can find those and mark them for later permission changes. So if you are willing to change permissions try this: sudo chmod -R go+rx /var/www/html/ – dakka Jul 14 '15 at 23:46
  • ps aux relies on Apache running already. You can also search the conf file: egrep -i '^user|^group' /etc/httpd/conf/httpd.conf (from @quanta serverfault.com/a/416239/15882) – matt wilkie Feb 3 '17 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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