Special usage of COMMON commands CP
Cp-i # Overlay hint alias cp= "Cp-i" mv-i # Overlay hint alias mv= "Mv-i"
Cp-r # Copy directory cp-a # reserved permissions
Cp-s a B # link file, only with current directoryln-s a B # A To use absolute path, B can not cp-d a B # directly copy a linked file, so B Also Link to a linked file
Chattr, Lsattr
chattr +i File # makes the files unable to move chattr +a the filename # Append, can only be added, cannot be deleted and modified, to be deleted first Chattr-a filelsattr
Observing file types
Stat
FILE:ASCII data binary or is there a dynamic function library
Type
| -T |
Show him the meaning of file. Alias. Builtin built-in |
| -A |
Lists the path |
| -P |
Displays the full file name of the external directive |
File Special permissions: ID (list your own information)
Add another 1 digits before you change the permission 3 digits chmod nxxx FILE
| 4 |
SUID s Owner |
| 2 |
SGID S Group |
| 1 |
Sbit T Other |
These 3 permissions are required by the X permission to support all, if a file does not have X permission, then directly to give
Special permissions will be overhead, is virtual, the system will prompt these permissions are capitalized SST
Suid:set UID
The S flag, which allows the executable to be owned by the host when it is run.
As long as you have X and suid, you can become USER at run time.
Pstree-u | grep root | | | -PASSWD (Root)
When a normal user runs passwd, it switches to the root identity.
SUID can only be used in binary files and cannot be used in shells
Sgid:set GID
When s this flag appears in group X, it is called set GID
The file is executed with the same rights as the user group.
After the directory has set the SGID permissions
- Users can enter this directory if they have r and X permissions for this directory;
- The user's active group (effective group) in this directory will become a group of that directory;
Use: If the user has the permission of W in this directory (can create a new file), users are established
New file, the group of the new file is the same as the group in this directory.
Sticky Bit
Sbit is currently only valid for the directory, when the user has W, x permission for this directory, but also has write permission;
When a user creates a file or directory under that directory, only himself and Root have the right to delete the file.
Linux Basic Knowledge Note 1--Permissions