Find the answer to your Linux question:
Results 1 to 4 of 4
I want users on my system to be able to chown their files. I'm learning Linux but didn't see anything in the man about who can chown when. I tried ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2003
    Posts
    57

    When can I "chown"


    I want users on my system to be able to chown their files. I'm learning Linux but didn't see anything in the man about who can chown when. I tried it logged in as a user and got this:

    [rbase@managed9 rbase]$ chgrp root newfile.delete
    chgrp: changing group of `newfile.delete': Operation not permitted

    As root (or anyone else besides rbase in this case), do I have any control over whether I WANT to receive the file?

    Hopefully the options are complex but understandable

    Sam Fullman

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Sorry, due to security precautions, the kernel won't let anyone but root change the UID of a file. root can change both the UID and GID arbitrarily, but an ordinary user can only change the GID to anything that he/she is a member of. See the SGID bit on directories.

  3. #3
    Just Joined!
    Join Date
    Apr 2003
    Posts
    57

    about SGID directories

    You're the second person who mentioned that -- where you set a directory that any file contained in it will have a certain user or group no matter who creates it. I'd like to learn how to implement this, could you give an example or show me a man reference?

    Thanks very much!!!
    Sam Fullman

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    It's only possible with groups, not users.
    This is a common thing for me to do, for example: as root, do this:
    Code:
    mkdir test
    chown root:users test
    chmod 3775 test
    That gives test rwxrwsr-t permissions, ie. rwx for root and users, and r-x for world, plus SGID and sticky bits. That means that everyone in the "users" group can create files in the directory, and no matter what their primary group is, the file will have the GID of "users". The sticky bit also ensures that only the owner of a file can delete it.
    See the texinfo docs for chmod for more info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •