I am confused with groups in Linux. Considering that user1 is in both groups user1 and user2 (and vice versa):user1> id user1uid=1000(user1) gid=1000(user1) groups=1000(user1),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),50(staff),113(lpadmin),130(sambashare),131(vboxusers),1001(user2)user1> id user2uid=1001(user2) gid=1001(user2) groups=1001(user2),0(root),1000(user1)I do not understand why user1 cannot edit a -rwxrw-r-- file owned by the user2 and group user2:user1>ls -l hey.xml-rwxrw-r-- 1 user2 user2 8385 May 24 11:39 hey.xmluser1>echo fails >> hey.xml bash: hey.xml: Permission deniedbut it works when I change the group:user1> sudo chgrp user1 hey.xml user1> echo works >> hey.xml Once this question is hopefully answered, what can I do to always allow user1 to read-write files in that user2 group?Thanks
Automatically allow user1 in group1 to edit file with owner user2 and group user2
users;group
If you add a user to a group, the new membership will not take effect immediately.  The easiest way to ensure this is current is to have the user whose group membership has been changed log out and back in again.  Once done, the user should be able to access files as expected.