I created a new group and assigned two existing users to that group as follows:
sudo groupadd mygroup
sudo adduser user1 mygroup
sudo adduser user2 mygroup
Now user1 has a directory called 'code' inside '/home/user1'. This user1 wants to change group ownership of this 'code' directory as follows:
ls -l
drwxrwxr-x 2 user1 user1 4096 Oct 10 07:54 code
whoami
user1
chgrp mygroup code
chgrp: changing group of ‘code/’: Operation not permitted
failed to change group of ‘code/’ from user1 to mygroup
Any ideas what may be going on here? Is it possible that even though user1 and user2 are members of the 'mygroup' they need something else to be able to assign files/directories to that group?
user1
log out and back in (or at least start a new login shell, for examplesu -l user1
). Otherwise the new group membership won't be in effect yet (check with commandgroups
).groups
was showing the membership but user1 was using a gnome-terminal so I had logged out at user1 and logged back in. That resolved the issue. Thanks a bunch for your help!!