chmod [options] mode files
This feature can only be used by a file owner or a privileged user to change the file access mode. Mode can be expressed in digital form or in the form of who opcode permission. Who is optional and the default is a (all users). Only one opcode (opcode) can be selected. Multiple mode can be specified, separated by commas.
Options:
-c,--changes
only the information of the changed file is output
-f,--silent,--quiet
users who do not notify the file when chmod cannot change the file mode
--help
output help information.
-r,--recursive
recursively traverse subdirectories to modify all files and subdirectories in the directory
--reference=filename
to set permissions by referencing the permissions of the filename
-v,--verbose
output information for each file, regardless of whether the modification was successful
--version
output version information.
W.H.O.
u
User
g
Group
o
other
a
all Users (default)
opcode
+
Increase Permissions
-
Delete Permissions
=
Reassign Permissions
Permission
R
Read
W
Write
x
Execution
s
set the ID number of the user (or group)
T
set the sticky bit (sticky bit) to prevent files or directories from being deleted by the non-owner
u
user's current permissions
g
Current permissions for the group
o
Current permissions for other users
for selection, most of us represent permissions in the form of three-bit octal digits, the first specifies the permissions of the master, the second specifies the group permissions, the third specifies the permissions of the other user, and each bit determines the permissions by 4 (read), 2 (write), 1 (executed), and three values. If 6 (4+2) represents a read-write right, 7 (4+2+1) has read, write, and execute permissions.
You can also set the fourth bit, which is in front of the three-bit permission sequence, and the fourth digit value is 4,2,1, which means the following:
4, the user ID is set at execution time, and is used to authorize the file owner-based process instead of the user who created the process.
2, when executed, sets the user group ID, which is used to authorize the process based on the group of files, rather than on the user who created the process.
1, set the sticky bit.
Example:
$ chmod u+x file adds execute permission to the owner of file
$ chmod 751 file assigns read, write, execute (7) permissions to the owner of file, assigns read, execute (5) permissions to the group where the file resides, and assigns permissions to other users to execute (1)
$ chmod u = rwx, g = Rx, o = x file Another form of example
$ chmod = R file assigns Read permissions to all users
$ chmod 444 file above example
$ chmod a-wx, a + R file above example
$ chmod-r u+r directory recursively reads permissions for the owner of all files and subdirectories in directory directory
$ chmod 4755 sets the ID to assign read, write, and execute permissions to the owner, assigning read and Execute permissions to the group and other users.
Permissions CHOMD under Linux