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?


6754 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.