Command: chmod (change the properties of a file)
R:4
W:2
X:1
How to use: chmod 744 1.txt (assigning values to 1.txt files)
chmod u=rwx,g=rw,o=r-x 1.txt (assigning values to 1.txt files)
chmod u-x 1.txt (1.txt file owner minus x permission)
CHMOD-R 700 111 (Change permissions for 111 directories and inherit permissions for all files and directories in the 111 directory 111 directories)
Umask (Specify permissions for default directories and files)
Change method: Umask 011 (change umask to 0011)
0022 after use three bit 022 convert to----w-w-
The default directory permission is rwx rwx rwx-----w-w-=rwx-r-x r-x
The default file permissions are rw-rw-rw------w-w-=rw-r--r--
Password change
Command: passwd
Password Storage address:/etc/shadow
Special permissions
U+s = 4755; g+s = 2755; O+t = 1755
Suid (s permission, binary executable to get s permission, the user who executes the file temporarily obtains the owning master permission; color is red)
How to use: chmod u+s/user/bin/ls
chmod u-s/user/bin/ls
Corresponds to the owner of the RWX permission, if there is a s permission, is the RWS, if the owner does not have X permission is represented as RWS
Sgid (s permission, binary executable to obtain the S permission, the user who executes the file temporarily obtains the group permissions; color is * * *)
How to use: chmod g+s/user/bin/ls or chmod g+s/tmp/111
chmod g-s/user/bin/ls or chmod g-s/tmp/111
Sgid can act on the directory
If Sgid works on a directory, create a file or directory under a directory, and create a directory and file that is consistent with the owning group of the parent directory
corresponding to the rwx permission in the genus Group, if there is an S permission, it is RWS, and if the group does not have X permission, it is represented as RWS
Sticky_bit (anti-delete bit)
Whether a file in a directory can be deleted, depending on the permissions of the directory, and if the directory is writable, you can delete any file in that directory, regardless of the operating user
How to use: chmod o+t 111
chmod o-t 111
Add T permission to prevent other users from deleting files in this directory
The T permission can be used in the directory, the effect on the file is meaningless
Permissions modification commands and methods under Linux