Quantcast
Channel: Viktor Balogh's HP-UX blog » files
Viewing all articles
Browse latest Browse all 8

Sticky revealed – difference between rws and rwS

$
0
0

This will be a short one. I just wanted to make myself a short reminder about Unix permissions. The theory about SUID/SGID/Sticky bits are already clear. But there is a slight difference between SUID and SUID (sic!):

# ll test
-rwxr-xr-x 1 root root 0 Jul 20 16:56 test
# chmod u+s test
# ll test
-rwsr-xr-x 1 root root 0 Jul 20 16:56 test
# chmod u-x test
# ll test
-rwSr-xr-x 1 root root 0 Jul 20 16:56 test
#

As you see, the difference is in the uppercase/lowercase – if the execute permission isn’t granted then the ‘s’ for SetUID is uppercase. And it’s valid for the another two too (SetGID and Sticky). Just for clearness here are the definitions:

SUID on file: the file will be executed with the rights of the owner
SGID on file: the file will be executed with the rights of the owner’s group
SGID on directory: the new files under that directory will be made with the same group as the parent directory
Sticky on file: it has an obsoleted meaning: the data part will be sticked into memory, it won’t swapped/paged to disk.
Sticky on directory: the contents of the dir can only be deleted by the owner, regardless what other read/write/execute permissions are applied


Viewing all articles
Browse latest Browse all 8

Trending Articles