How to view and modify file read/write permissions in Linux

Source: Internet
Author: User

Statement for viewing file permissions:

Enter at the terminal:

Ls-l xxx. xxx (xxx. xxx is the file name)

Then similar information will appear, mainly including:
-Rw-r --

A total of 10 digits

The first one indicates the type.

The three rw in the middle represents the owner (user)

Then the three rw-represent the group)

The last three r groups represent other people (other)

Then I will explain the nine digits below:

R indicates that the file can be read)

W indicates that the file can be written)

X indicates that the file can be executed (if it is a program)

-The permission has not been granted.

Now let's talk about modifying file permissions.

Enter at the terminal:

Chmod o + w xxx. xxx

Grant other users the permission to write the file xxx. xxx.

Chmod go-rw xxx. xxx

Deletes the read and write permissions of group groups and other persons in xxx. xxx.

Where:

U stands for the owner (user)

G indicates the group in which the owner is located)

O stands for others, but not u and g (other)

A Represents all people, including u, g, and o

R indicates that the file can be read)

W indicates that the file can be written)

X indicates that the file can be executed (if it is a program)

Rwx can also be replaced by numbers.

R ------------ 4

W ----------- 2

X ------------ 1

------------- 0

Action:

+ Indicates adding permissions.

-Indicates the permission to be deleted.

= Indicates that it is the only permission

After everyone understands the above, we can easily understand the following common permissions:

-Rw ------- (600) only the owner has the read and write permissions.

-Rw-r -- (644) only the owner has the read and write permissions. The Group and others have only the read permissions.

-Rwx ------ (700) only the owner has the read, write, and execute permissions.

-Rwxr-xr-x (755) only the owner has the read, write, and execute permissions. The Group and others have only the read and execute permissions.

-Rwx -- x (711) only the owner has the read, write, and execute permissions. The Group and others have only the execution permissions.

-Rw-(666) everyone has the read and write permissions.

-Rwxrwxrwx (777) everyone has the permission to read and write and execute

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.