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
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?

  • 1
    Did user1 log out and back in (or at least start a new login shell, for example su -l user1). Otherwise the new group membership won't be in effect yet (check with command groups). – steeldriver Oct 10 '16 at 14:07
  • Command 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!! – sshekhar1980 Oct 10 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.