0

This question was flagged as duplicate, and I looked at the suggested question. It did not explain why there are four numbers instead of three. Like in WordPress. the folder permissions you should never set it to is 7777. What does the fourth number mean, and can someone provide a simple, lay person explanation?
I was reading an article here and it mentioned three sets of numbers ranging from 0 to 7.
Read = 4.
Write = 1.
Execute = 2.
To get read-write permissions, add 4 and 2 to get six, and to get read and execute, you add 4 and 1 to get 5. If you want write and execute, add 2 and 1 to get 3. To not set permissions, set it to 0, and to allow all permissions, set it to 7.
The article says three numbers are needed. The first number sas that you, the owner, are given permission. The second number is for the group that the account is a part of. The third number is for everyone else. For example, the number 750 indicates that I, the owner can do everything, everyone in my group can read and execute, and anyone else who is not in my group cannot access it. However, I have seen four numbers instead of three. Like 0644 which indicates someone doesn't have any permission, there is a read and write number, and two read permissions. 7777 means that everyone regardless of who is accessing the system has access to read, write, and execute.
Finally, what's the difference between reading, writing, and executing? And why do I sometimes see RWSRWSRT in Win SCP?

  • 1
    reading writing and executing a file have their normal English meanings; for a directory it's a little more nuanced - see for example Execute vs Read bit. How do directory permissions in Linux work? . You may see things like rwsrwsrwt when using filesystems that do not support Unix-style permissions at all (such as FAT or NTFS). – steeldriver Jan 14 '18 at 13:32
  • @steeldriver … or when applying chmod 7777 to a file. This gives -rwsrwsrwt (on ext4). But I don't know if anybody can immediately tell the impact of this. ;-) – PerlDuck Jan 14 '18 at 14:04
  • @PerlDuck some explanation (with examples) here: setuid, setgid, sticky bit – steeldriver Jan 14 '18 at 14:11
  • @steeldriver Yes, we can read what exactly those funny s and t (and S and T) characters mean. I just think that most people cannot tell without reading the docs. ;-) They are simply used too rarely to be familiar with them. Except for g+s for directories, I guess, which is more common. – PerlDuck Jan 14 '18 at 14:19
  • I haven't found anything useful or concrete yet. What does sticky bit mean? I'm guessing set uid and set gid mean set user ID, and set group ID. But there are two more numbers. 777 would be allow permissions for owner, group, and everyone else in the system. But add a fourth number and I don't know what that fourth number represents. – HeavenlyHarmony Jan 14 '18 at 16:15
  • @steeldriver - do you want to post that as an answer ? user24489 You are getting confused by the leading first bit, often called a "sticky bit" See https://www.thegeekdiary.com/what-is-suid-sgid-and-sticky-bit/ . See also https://askubuntu.com/questions/394067/why-use-sticky-bit and similar google searches. – Panther Jan 14 '18 at 17:06
  • Other references might be the articles about the sticky bit and setuid/setgid on Wikipedia and the proposed duplicate question How do file permissions work?. – PerlDuck Jan 14 '18 at 17:11
  • This question was flagged as an exact duplicate, however the previous question marked here only talks about the three numbers, not four, which is what I want to know why there are sometimes four numbers instead of three. – HeavenlyHarmony Jan 15 '18 at 01:49

0 Answers0