Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a folder at /home/www/, and the owner is www, which is part of the www-group. I have another user, john, part of the john group. How can I chown /home/www/ to make it writable by both www and john? Thanks

share|improve this question

3 Answers 3

up vote 13 down vote accepted

Rather than modify permissions on the directory, it might be easier to put the user john into the www group. Users can be in multiple groups. Use either usermod, edit the /etc/group file, or if you have a GUI on your linux machine use the graphical user manager program (might be called different names based upon distro and desktop environment). The easiest method is probably to open a command prompt, and type in:

sudo usermod -G www -a john

It'll ask for your account password, and once you enter it, the user john will be have group level access to the /home/www directory.

This is assuming the group www already has read/write/execute access to the /home/www directory If that group doesn't have that level of access then use chgrp www /home/www and chmod g+rwx /home/www to take care of that.

note: if you are currently logged in as 'john', you may need to log out and back in for your permissions to update.

share|improve this answer
3  
Or create another group that both www and john are in, if you need finer grained access. –  KeithB May 11 '10 at 20:46

You can't. But you may be able to set an ACL for it.

setfacl -m g:john:rwx /home/www
share|improve this answer
    
You will probably need to add acl to mount options (either in fstab or using mount -o remount,acl /). –  grawity May 11 '10 at 19:12
    
Also, don't forget that giving rwx for /home/www does not give write access to the files inside. –  grawity May 11 '10 at 19:13

Try creating new group www-and-john, then

chown -R www:www-and-john /home/www/

chmod -R g+w .

and in the end add both users to group www-and-john.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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