Why does the command chmod 6754
correspond to the file permissions rwsr-sr-
?
I understand that Read = 4, Write = 2, and Execute = 1, but what value does the s
(setuid) permission or the dashes have?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this community6754
sets the world, group, user, and UID bits on a file or directore, right-to-left. For the UID bits, they correspond to --s--s--s
in a ls -l
listing. That chmod
is setting bits as follows:
6 --s--s---
7 rwx
5 r-x
4 r--
Since, by this metric, s
overrides x
, when these permissions are "summed up", you get rwsr-sr--
.
From info '(coreutils)Numeric Modes'
:
Special mode bits:
1000 Restricted deletion flag or sticky bit
2000 Set group ID on execution
4000 Set user ID on execution