Linux chmod command

Source: Internet
Author: User

Chmod [Options] mode files can only be used by file owners or privileged users to change the file access mode. Mode can be in the digital format or in the WHO opcode permission format. Which is optional. The default value is a (all users ). Only one opcode can be selected ). You can specify multiple modes separated by commas. Options:-C, -- changes only outputs the information of the changed file-F, -- silent, -- quiet. When chmod cannot change the file mode, the user -- Help of the file is not notified to output help information. -R, -- Recursive recursively traverses sub-directories, and applies the modification to all files and sub-directories in the directory. -- reference = filename sets the permission by referring to the filename permission.-V, -- verbose outputs the version information of each file no matter whether the modification is successful or not. Who U user G group O all other a users (default) opcode + Add permission-delete permission = re-assign permission R read w write x execute s set user (or group) the ID number t is set to sticky bit to prevent files or directories from being deleted by a non-owner, most of us use three Octal numbers to indicate permissions. The first one specifies the permissions of the owner, the second one specifies the group permissions, and the third one specifies the permissions of other users. Each user passes 4 (read) the sum of 2 (write) and 1 (execution) Values to determine permissions. For example, 6 (4 + 2) indicates that you have the read and write permissions, and 7 (4 + 2 + 1) indicates that you have the read, write, and execution permissions. You can also set the fourth digit, which is located before the three-digit permission sequence. The fourth digit is 4, 2, and 1, which indicates the following: 4. Set the user ID during execution, used to authorize a process based on the file owner, rather than to the user who creates the process. 2. Set the user group ID during execution to authorize the process based on the file group, instead of the user who creates the process. 1. Set the adhesion position. Instance: $ chmod U + X file adds the execution permission to the file owner $ chmod 751 file assigns the read, write, and execute (7) permissions to the file owner, assign the read and execute (5) permissions to the group where the file is located, and assign the execution (1) permissions to other users $ chmod u = rwx, G = RX, O = another form of example on X file $ chmod = r file assigns read permissions to all users $ chmod 444 file same as above $ chmod A-WX, A + R file is the same as the preceding example. $ chmod-r u + r directory recursively assigns read permissions to the owner of all files and subdirectories in the directory $ chmod 4755 sets the ID, assign read, write, and execution permissions to the owner, and assign read and execution permissions to the group and other users.

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.