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
3 Answers
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.
- 3,671
- 22
- 16
-
3Or create another group that both www and john are in, if you need finer grained access. – KeithB May 11 '10 at 20:46
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.
- 24,206
- 28
- 102
- 134
- 131
- 3
You can't. But you may be able to set an ACL for it.
setfacl -m g:john:rwx /home/www
- 111,361
- 10
- 201
- 247
-
You will probably need to add `acl` to mount options (either in `fstab` or using `mount -o remount,acl /`). – u1686_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. – u1686_grawity May 11 '10 at 19:13