Ubuntu – Understanding Group Permissions

permissions

I'd appreciate help with a couple questions regarding standard file permissions. Assume that I'm not using access control lists.

  1. If a file is associated with multiple groups, must all groups have the same permissions?
  2. If the group permission includes write access, can any member of any group the file is associated with change the file permissions? Can such a person change the file owner?
  3. Say now the file permission is rwxr—– (owner can do everything, but group members can only read). I am in the group associated with the file. I am also the file owner. Which permission am I granted? Read-only, or rwx?

Best Answer

  1. A file can only have one group

  2. Only the owner of the file can do that.

    $ sudo touch ~/tmp/test
    $ sudo chown root:aboettger ~/tmp/test
    $ ls -la ~/tmp/test
    -rw-rw-r-- 1 root aboettger 853 Jun 19 08:26 /home/aboettger/tmp/test
    $ chmod g-w ~/tmp/test 
    chmod: changing permissions of 'test': Operation not permitted
    
  3. You have rwx access rights

And you should read this. ;)

Related Question