Linux command chmod

Source: Internet
Author: User

1. Introduction

In Linux, a file or directory has a lot of permissions, and the most basic permissions are nine, respectively, the owner , the user group , the other person 's three objects read, write, execute the permissions.

The chmod command is used to change the permissions of the file/directory. There are two ways to change permissions for a file: 1. Use the number 2. Using symbols

2. Specific Methods

   All methods follow this pattern: chmod [Options] [ugoa]* ([-+=] ([rwxxst]*|[ Ugo]) +| [-+=] [0-7]+ filename

 Options

(1)-C,--changes to change the permissions of the file when successful, will print a line of content report changes the content of the permissions

chmod -Cu+ 'a.c'06440744 (rwxr--r--)

Note: The above 0644 of 0 represents the '-', indicating the document, the number code is "0";

There are also symbolic connection permissions

(2)-F,--silent,--quit remain silent

(3)-V,--verbose will always remind you and C very similar so is jumbled, a variety of

(4)-r most commonly used option to recursively change the permissions of files and directories

Number Type:

For each object of a file there are three permissions, read, write, and execute permissions, each of which corresponds to this score.

R:4 W:2 x:1

The values for each identity's permissions are cumulative, such as:

chmod 764 A.c[email protected]: ls -l A.C1: A.C

In this instance, the owner's permission is 7, is r+w+x =4+2+1=7, the user group's permission is 6 r+w=4+2=6, and the other person is 4 r=4.

 Character type:

Change file permissions with characters chmod [Augo] [+-=] [rwx] filename/dirname;

A:all includes all object U:user, only changes the owner's permission G:group, only changes the user group's permissions o:others, only changes the other person's permission

+: Add permissions-: Delete permissions =: Set permissions

Like what:

[Email protected]:~#ls-L. Bash_history-RW-------1Root root26291The -  the: Wu. Bash_history[email protected]:~#chmodu=rwx,go+W. bash.bash_history. BASHRC [email protected]:~#chmodu=rwx,go+W. bash_history [email protected]:~#ls-L. Bash_history-rwx-W--W-1Root root26291The -  the: Wu. bash_history

At first, only the owner can read and write, u=rwx to the owner of all permissions, go+w to the user group and other people added W permissions.

Linux command chmod

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.