Linux Rights Management commands
1. Change file or directory permissions: chmod
Command name: chmod command English Original: Change the permissions mode of a file command where the path:/bin/chmod Execute permissions: All user syntax: chmod [{ugo} {+-=} {rwx}] [file or directory] [mode=421] [File or directory] Function description: Change file or directory permissions
Representative character |
Permissions |
The meaning of the file |
The meaning of the directory |
R |
Read permissions |
Can view the contents of a file |
You can list content in a directory |
W |
Write permissions |
Can modify the contents of a file |
You can create and modify files in the directory |
X |
Execute permissions |
Can execute file |
Access to Directory |
File:
Read Permissions R operation : Cat, More, head, tail; Write permission W operation: Echo, VI; Execute permissions x: command, script
Directory:
Read Permissions R operation: LS (List contents in the directory); Write permission W operation: touch, mkdir, RM; Execute permissions x: CD
2. Change the file owner: Chown
Command name: Chown Command English Original: Change file ownership command path:/bin/chown Execute permissions: All user syntax: chown [user] [file or directory] function description: Changes the owner of the files or directories
3. Change the owning group of the file or directory: Chgrp
Command name: CHGRP Command English Original: Change file group Ownership command path:/BIN/CHGRP Execute permissions: All user syntax: chgrp [user] [file or directory] function description: Changes the group of files or directories belonging to
4. Default permissions for display, device files: umask
Command name: Umask command in English: command path:/bin/umask Execute permissions: All user syntax: Umask [-S]-s to display new file or directory default permissions in rwx form umask [permission mask value] Modify default Permissions function Description: Display, set file The default permissions
Example:
[Email protected] test]# umask-su=rwx,g=rx,o=rx[[email protected] test]# umask0022
Description: the umask command returns 0022, the first bit 0 represents the special permission bit, the latter three bits 022 represents the user permission bit, is the permission mask value , and its permission should be 777 minus its value.
Note: Linux permissions rule: Files created by default cannot grant executable x permissions
[Linux Learning Notes] Linux Common commands-rights management commands