Linux chmod Command Detailed

Source: Internet
Author: User

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 outputs the information of the changed file
-f,--silent,--quiet a user who does not notify a file when chmod cannot change the file mode
--help output help information.
-r,--recursive can recursively traverse subdirectories and modify them to 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
Group G
o Other
A All users (default)
OpCode
+ Add Permissions
-Delete Permissions
= Reassign Permissions
Permission
R Read
W Write
X execution
s sets the ID number of the user (or group)
T set the sticky bit (sticky bit) to prevent files or directories from being deleted by non-owner
U user's current permissions
Current permissions for Group G
o Other users ' current permissions
As a choice, most of us represent permissions in the form of three-bit octal digits, the first one specifying the permissions of the master, the second specifying the group permissions, and the third specifying the permissions of the other user, each of which is determined by 4 (read), 2 (write), 1 (executed), and three numeric 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.
Instance:
$ chmod u+x file to the owner of file add Execute permission $ chmod 751 file to the owner of the file to assign read, write, execute (7) permissions to the group where file Assign Read, execute (5) permissions, assign execute (1) permissions to other users $ chmod u=rwx,g=rx,o=x file in another form of the example $ chmod =r file assigns read permissions to all users $ chmod 444 file above example $ chmod a-wx,a+r file same as $ chmod-r u+r directory recursively to all files in directory directory And subdirectories of the owner-assigned Read permissions $ chmod 4755 set with ID, assign read, write, and execute permissions to the owner, and assign read and execute permissions to the group and other users.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.