Linux chmod Command Detailed

Source: Internet
Author: User

the chmod command is used to change the permissions of a file or directory. In the UNIX system family, the control of file or directory permissions is distinguished by reading, writing, performing 3 general permissions, and 3 special permissions are available for use. The user can use the chmod instruction to change the file and directory permissions, the format of the use of text or digital code can be. The permissions of the symbolic connection cannot be changed, and if the user modifies the permissions on the symbolic connection, the change will affect the original file being connected. chmod----Changing the access mode of one or more files (mode) 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,--changesonly the information of the changed file is output -f,--silent,--quietusers who do not notify the file when chmod cannot change the file mode --helpoutput help information.  -r,--recursiverecursively traverse subdirectories to modify all files and subdirectories in the directory --reference=filenameto set permissions by referencing the permissions of the filename -v,--verboseoutput information for each file, regardless of whether the modification was successful --versionoutput version information.  W.H.O. uUser gGroup oother aall Users (default) opcode +Increase Permissions -Delete Permissions =Reassign Permissions Permission RRead WWrite xExecution sset the ID number of the user (or group) Tset the sticky bit (sticky bit) to prevent files or directories from being deleted by the non-owner uuser's current permissions gCurrent permissions for the group oCurrent permissions for other users 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.  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 Another form of the example on U=rwx,g=rx,o=x file$ chmod =r file to assign 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.

Linux chmod Command Detailed

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.