However, if this permission is set for a directory, the user is prevented from deleting or renaming the file, unless the user is the owner, file owner, or super user of the Directory. It is often used
Introduction
Although the octal mask is usually represented by three digits. But technically, it is represented by four digits.
Why? In addition to the read, write, and execute permissions, there are some other less-used permissions.
========================================================== =
Setuid bits (octal representation: 4000)
When it is applied to an executable file, the valid user ID is set from the actual user ID (the user who actually runs the program) to the ID of the owner of the program.
In most cases, this permission setting is usually used in programs owned by super users.
When a common user runs a program with the "setuid root" permission, the program is executed with the superuser permission.
This allows the program to access files and directories that are generally prohibited by common users. So be careful.
========================================================== =
Setgid bit (octal representation: 2000)
It is similar to the setuid bit. It will change the valid group ID from the user's actual group to the group ID of the file owner.
========================================================== =
Sticky bit (1000 in octal format)
This permission can mark an executable file as "unchangeable ".
In linux, the sticky bit of the file is ignored.
However, if this permission is set for a directory, the user is prevented from deleting or renaming the file, unless the user is the owner, file owner, or super user of the Directory.
It is often used to access shared directories.
========================================================== =
Example
[Root @ allyes ~] # Chmod 2777 1.txt
You have new mail in/var/spool/mail/root
[Root @ allyes ~] #
========================================================== =