If you are working on Linux environment and working on some programs/scripts then you might have used chmod often for sure. Many of us think that what’s there in chmod to remember. Why people write so many articles on one of the simplest command in Linux which even a newbie use it like anything.
Then my question to all Linux users is that ???how many octets a full permissions set have????. I know, many Linux users would say three within three seconds but it’s four literally. Stumped right?
Usually we write
chmod 777 file
But what we are actually saying:
chmod 0777 file
The first octet works the same way as the other three works, as it has the same 3 possible values that adds to make the octet :
4 – setuid (letter used for it: s)
2 – setgid (letter used for it: s)
1 – sticky bit (letter used for it: t)
Note: your first octet will always be reset to 0 when using chown or chgrp on files. We need not to worry when using chown and chgrp. It’s effective only on chmod then: D
Let’s see what those 3 values mean for the first octet.