Basic permissions include 3 types: R-Read, W-write, X-Execute
Roles are also divided into 3 categories: U-owning, G-owning group, o other
R, W, x correspond to 4, 2, 1, respectively
You can set permissions using U, G, O + R, W, X, or directly using numeric values such as 755
* When the directory has write permissions, the representative can add to the directory, delete, empty, and so on, and the directory under the specific permissions of the file Independent
When you have write permission on a file, you can only modify the contents of the file, not the delete operation.
Special permissions
Setuid,setgid, the sticky bits correspond to 4,2,1 respectively.
Sticky bit meaning: the sticky bit of the directory indicates that the files in this directory can only be deleted by owner and Root, and the TMP directory is an example
Ll/tmp permissions for drwxrwxrwt,t for sticky bits
How to set: chmod 1755 dirname
Setuid and Setgid
Setuid only works on commands and executables/usr/bin/passwd is an example
Ll/usr/bin/passwd-rwsr-xr-x,s Representative setuid
How to set: chmod 4755/usr/bin/passwd or chmod u+s/usr/bin/passwd
On behalf of the executor of the command is performed by the owner of the command.
Setgid only works for commands and executables
How to set: chmod 2755 xxx or chmod u+s xxx
The performer on behalf of the command is executed in the same group as the command.
Example: Modify/bin/mkdir chmod G+s/bin/mkdir
Switch to a non-root user, execute mkdir, view the owning group of the mkdir, the group that belongs to is root, not the current user's group
Relationship of Linux roles and permissions