1. Introduction
chmod: The command is the command that controls the user's permissions on the file
2. Read, write and execute permissions
r
, w
, x
represent read, write, and execute permissions respectively
4, 2, and 1 represent read, write, and execute permissions respectively, and 7 represents all execution, readable, writable, and executable
permissions | permission number | Concrete action | ||
readable | r | 4 | read , read. The current user can read the contents of the file, | 7 means all permissions, readable, writable, and executable |
writable | w | 2 | write , write. The current user can add or modify the content of the file, and the current user can delete or move the directory or the files in the directory. | |
executable | x | 1 | execute , execute. The current user can execute files, and the current user can enter directories. |
3. Use
chmod 765 filename
Linux/Unix file call permissions are divided into three levels:
The position of the first number 7 indicates that the owner of the file (Owner) has read, write and execute permissions owner = rwx = 4+2+1 = 7
The position of the second number 6 indicates that the user group (Group) has read and write permissions. The group to which it belongs = rw- = 4+2 = 6
The position of the third number 5 indicates that other users (Other Users) have read and execute permissions. Others = rx = 4+1 = 5