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.
-
3Or create another group that both www and john are in, if you need finer grained access.– KeithBMay 11, 2010 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
.
You can't. But you may be able to set an ACL for it.
setfacl -m g:john:rwx /home/www
-
You will probably need to add
acl
to mount options (either infstab
or usingmount -o remount,acl /
). May 11, 2010 at 19:12 -
Also, don't forget that giving
rwx
for/home/www
does not give write access to the files inside. May 11, 2010 at 19:13