Chgrp: Not owner



  •  This one has been pissing me off all week. Can any of you shed any light?

    server:/path> touch b
    server:/path> ll b
    -rw-r--r--   1 me group 0 Apr  9 11:37 b
    server:/bath> chgrp group2 b
    chgrp: b: Not owner
    server:/path> whoami
    me

    WTF?  I do own the file!  Why won't you listen to me?  Here's the version info if it helps.

     

    server:/path> cat /etc/*release
                           Solaris 8 2/04 s28s_hw4wos_05a SPARC
               Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
                                Assembled 08 January 2004

     



  • Are you a member of group2?

    http://www.zotline.com/shownote.zot/NoteNum/4039.html

     



  • @CodeSimian said:

    Are you a member of group2?

    No, I'm not.  I see now.  

    Is that standard UNIX behavior or a true WTF?

    Thanks, by the way.  I actually screamed at my computer just before making the OP.



  • @belgariontheking said:

    @CodeSimian said:

    Are you a member of group2?

    No, I'm not.  I see now.  

    Is that standard UNIX behavior or a true WTF?

    Thanks, by the way.  I actually screamed at my computer just before making the OP.

     

    No problem.  I think it's standard behaviour and the error message is the real WTF.   Under GNU/Linux, I get this error message in your situation:

    chgrp: changing group of `foo': Operation not permitted
     

    On the other hand, it also says "Operation not permitted" when you don't own the file.  Oh well, guess it's better for the message to be vague, rather than misleading.



  • @belgariontheking said:

    Is that standard UNIX behavior or a true WTF?

    Something like security protection. Imagine:

    $ ls -l some_file_execing_id
    -rwxr-xr-x 1 viraptor viraptor 12345 Apr  9 20:47 some_file_execing_id
    $ ./some_file_execing_id
    uid=1000(viraptor) gid=1000(viraptor) ....
    $ chgrp root some_file_execing_id
    $ chmod g+s some_file_execing_id
    $ ./some_file_execing_id
    uid=1000(viraptor) gid=0(root) ....

    That's probably reason similar to why windows doesn't allow forcing ownership of a file on someone else (only giving rights to take ownership afaik) Also "giving" someone else your file would mess with quota too much.



  • Too add to what viraptor said...

    The first reason for doing this was probably to prevent users from getting around disk quotas. If you transfer a files ownership to a different user or group it would be counted for that entities quota and not yours.

    The other reason is so that the sysadmins don't need to go digging very far to find out who owns what viruses, porn, or other programs that annoy them.



  • @Rotary Jihad said:

    The first reason for doing this was probably to prevent users from getting around disk quotas.
     

    Not so much getting around quotas, as stopping a denial of service attack on whoever you were transferring the files to. chgrp'ing a file would still leave you as owner and have the file counted against your own user quota, as well as the group's quota.




Log in to reply