I'm new to Linux admin'ing. I created a user named webadmin and I want to give it permission to read/write in the /var/www/html directory.

How do I go about doing this?

link|improve this question
What distribution? – SvenW Sep 12 '11 at 1:16
feedback

1 Answer

up vote 3 down vote accepted

Personally, I would set the ownership of /var/www/html to apache. You can do this by:

chown apache /var/www/html

Next, I would create a group of let's say "Web admins":

groupadd webadmins

Add the user webadmin to the newly created group:

usermod -G webadmins webadmin

Add group permissions to the newly created group:

chmod g+rw /var/www/html 
link|improve this answer
and also you can create ACL. – Luciano Facchinelli Sep 12 '11 at 0:54
On Debian-based distributions, this approach will fail as they run Apache as user/group www-data:www-data, not as apache by default. – SvenW Sep 12 '11 at 1:16
Thank you for that. – Richardp Sep 12 '11 at 2:02
Note that files and directories created by a user will be owned by the user's primary group. In order to preserve these group permissions for users who don't have apache as their primary group, you should also set g+s on the directory (and any pre-existing subdirectories). This will ensure that any file created underneath, regardless of who creates it or what their memberships are, are owned by the same group that owns the directory they're created under. – jgoldschrafe Sep 12 '11 at 2:06
feedback

Your Answer

 
or
required, but never shown

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