-1

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?

jasonwryan
  • 73,126
arcade16
  • 101
  • 3

2 Answers2

1

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--.

DopeGhoti
  • 76,081
0

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
agc
  • 7,223