Teaching:
Feedback
Keep in mind that programs such as ls or stat display the permissions
exactly the same regardless if the user that ran them is the owner or not,
belongs to the group whose the file is or not. One has to tell apart manually
which chunk of permissions to look at.
roo@host /tmp $ whoami roo roo@host /tmp $ groups bipedal jumping roo@host /tmp $ ls -l total 4 drwxr-x--x 5 roo jumping 160 Mar 16 20:04 myDir -rw----r-- 1 roo jumping 249 Mar 16 20:03 someFile roo@host /tmp $ stat myDir File: myDir Size: 160 Blocks: 0 IO Block: 4096 directory Device: 0,30 Inode: 90 Links: 5 Access: (0751/drwxr-x--x) Uid: (1234/ roo) Gid: (123/ jumping) roo@host /tmp $ stat someFile File: someFile Size: 249 Blocks: 8 IO Block: 4096 regular file Device: 0,30 Inode: 91 Links: 1 Access: (0604/-rw----r--) Uid: (1234/ roo) Gid: (123/ jumping)The user
roo is the owner of the file, so for the user only the first chunk matters.
tigger@host /tmp $ whoami tigger tigger@host /tmp $ groups jumping happy tigger@host /tmp $ ls -l total 4 drwxr-x--x 5 roo jumping 160 Mar 16 20:04 myDir -rw----r-- 1 roo jumping 249 Mar 16 20:03 someFile tigger@host /tmp $ stat myDir File: myDir Size: 160 Blocks: 0 IO Block: 4096 directory Device: 0,30 Inode: 90 Links: 5 Access: (0751/drwxr-x--x) Uid: (1234/ roo) Gid: (123/ jumping) tigger@host /tmp $ stat someFile File: someFile Size: 249 Blocks: 8 IO Block: 4096 regular file Device: 0,30 Inode: 91 Links: 1 Access: (0604/-rw----r--) Uid: (1234/ roo) Gid: (123/ jumping)The user
tigger is not the owner of the file,
but is in group jumping whose the file is,
so for the user only the middle chunk matters.
eeyore@host /tmp $ whoami eeyore eeyore@host /tmp $ groups quadruped glum eeyore@host /tmp $ ls -l total 4 drwxr-x--x 5 roo jumping 160 Mar 16 20:04 myDir -rw----r-- 1 roo jumping 249 Mar 16 20:03 someFile eeyore@host /tmp $ stat myDir File: myDir Size: 160 Blocks: 0 IO Block: 4096 directory Device: 0,30 Inode: 90 Links: 5 Access: (0751/drwxr-x--x) Uid: (1234/ roo) Gid: (123/ jumping) eeyore@host /tmp $ stat someFile File: someFile Size: 249 Blocks: 8 IO Block: 4096 regular file Device: 0,30 Inode: 91 Links: 1 Access: (0604/-rw----r--) Uid: (1234/ roo) Gid: (123/ jumping)The user
eeyore is not the owner of the file,
neither he is in group jumping whose the file is,
so for the user only the last chunk matters.