I have a server on Amazon ec2, When I try to change group file (chgrp danny /tmp/bla) I get "Operation not permitted". (I don't want to use "sudo") Anyone know the problem?
I think what Mike Scott is trying to explain is that only root, or someone elevated with sudo, can use the chgrp command.
You can edit your
visudo to allow a certain user to use only certain commands. For more information, please refer to
I think this could be a sticky bit issue. You can only change the group of a file if you have the right permissions and
/tmp is a special directory where the permissions of files are set to be the creator of the file (the 'sticky bit' is set on /tmp).
So your example of going onto another machine and doing
$ touch /tmp/bla $ chgrp newgroup /tmp/bla
would work fine as when you created the file with
touch it was created with your user/group. So you are allowed to alter the group. However, if another user created a file in
/tmp it would belong to them and your normal user
danny couldn't do anything to it. This is what I think your issue is.
Here's the requisite section from the wiki page:
When the sticky bit is set, only the item's owner, the directory's owner, or the superuser can rename or delete files. Without the sticky bit set, any user with write and execute permissions for the directory can rename or delete contained files, regardless of owner. Typically this is set on the /tmp directory to prevent ordinary users from deleting or moving other users' files.
The problem is that you don't want to use sudo. Change that, and you'll be fine.