The Computer Oracle

How to make a file editable by two different users in different groups?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Industries in Orbit Looping

--

Chapters
00:00 How To Make A File Editable By Two Different Users In Different Groups?
00:27 Accepted Answer Score 12
01:35 Answer 2 Score 2
01:46 Answer 3 Score 3
02:05 Thank you

--

Full question
https://superuser.com/questions/140029/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #permissions #ownership #chown

#avk47



ACCEPTED ANSWER

Score 12


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.




ANSWER 2

Score 3


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.




ANSWER 3

Score 2


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

setfacl -m g:john:rwx /home/www