File
File type
Create a file
Change permission bit
Symbol mode
R W x: File owner Permission This is the previous three bits
R-x: Same group of user rights This is the middle three bits
R-x: Other user rights This is the last three bits
The general format of the chmod command is:
chmod [who] operator [permission] filename
Who's meaning is:
U file belongs to master permission
G Same group User rights
o Other user rights
A All users (file owner. Same group of users and other users)
The meaning of operator:
+ Add Permissions
-Cancel Permissions
= Set Permissions
The meaning of permission:
R Read Permissions
W Write permission
X Execute Permissions
S file owner and group Set-id
t Sticky bit *
L Give folder locks so that other users cannot access
Example:
Suppose the myfile file originally had such permissions: R W x
RWX rwx
Command result meaning
chmod a-x myfile rw-rw-rw-recover execution rights for all users
chmod og-w myfile rw-r–r--Recover Write permissions for the same group of users and other users
chmod g+w myfile rw-rw-r--Give write permission to the same group of users
chmod u+x myfile rwx rw-r--Give file owner execution permission
chmod go+x myfile rwx rwx r-x giving the same group of users and other users permission to execute
The general form of the chmod command absolute mode is:
chmod [mode] File
For example:
Command results
chmod 666 rw-rw-rw-
chmod 644 rw-r–r--
chmod 744 rwx r–r--
chmod 664 rw-rw-r--
chmod rwx--
chmod 444 r–r–r--
Chmod-r 664/usr/local/home/dave/* can set permissions together with the files in the word directory
Catalogue
R: You can list files in a directory W: You can create or delete files in a directory x: You can search or enter a directory
Examples of directory permissions:
Permission files belong to other users of the main group
DRWX rwx r-x (775) Read and write execution reading execution
Drwx r-x R – (754) read-write execution read
DRWX r-x r-x (755) Read and write execution read execution reading execution
Suid/guid
ls ‘^...s..s‘//用来查找suid和guid文件的
How Suid and GUIDs are set
Example of setting Suid/guid
Chown and Chgrp
Chown and CHGRP examples
Find out which user group you belong to
Umask
How to calculate umask values
Umask Values and Permissions
Symbolic Links
Link command
Linux file Security and permissions