0

I know how to set read/write/execute with three numbers from the Arch wiki's file permissions page. I also know that chmod 7777 will set the setuid, setgid, and sticky bits to true. But which number controls these bits? Is it the first or the last number? Which value is set to true when a 1, 2, or 4 is passed as this value?

Edit: I have added this information to the Arch wiki for future reference.

My question is much smaller in scope than the proposed duplicate.

  • That question has a much larger scope than this one, I do not think they are similar enough to be duplicates. Also, that question does not come up when searching for this post's title. – Aaron Franke Mar 16 '17 at 21:46
  • 1
    the idea behind a duplicate is that your question's wording helps lead people to the answers that already exist – Jeff Schaller Mar 16 '17 at 23:58

1 Answers1

8

From the chmod man page:

A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file’s group, with the same values; and the fourth for other users not in the file’s group, with the same values.