Permissions for files under Linux

Source: Internet
Author: User

Recently engaged in a number of permissions to minimize the problem, here specifically for Linux under the file permissions summary, in fact, very simple.

In the introduction of Linux files under the situation, you need to first introduce a concept, users, user groups.

Like win, Linux also requires users to log in. The difference is that in Linux, there is also a concept: User groups. That is, the current user belongs to the genus Group. Why introduce such a seemingly useless group of users? This is primarily for the convenience of team collaboration under Linux. Each user has their own unique permission controls. But sometimes, there are public files or folders that you use, and I use them, but we don't want everyone to be able to use them. (Anti-theft connection: This article is starting from http://www.cnblogs.com/jilodream/) so the concept of a owning group was developed. We can add permissions only for this owning group. This allows all the accounts in the owning group to have permission to operate on the file.

Let's look at the control of file permissions below.

Permissions are made up of only three parts, whether users or groups of users

READ: R

Write (write): W

Execute (EXECUTE): X

such as the file F's user rights can be set to:

RWX: Represents the current user has read, write, execute three permissions.

R-x: Represents the current user has read and execute permissions. (Note: General execution scripts are set to such permissions)

Remember that the order of reading, writing, and execution is fixed, and the corresponding permission is used if not-(the horizontal line replaces the bit).

In the case of a computer user, if there is data, we usually use the one instead, and not the use of the space.

So:

R-x equals 0b101 is 5.

Rwx equals 0b111 is 7.

---equals 0b111 conversion is 0.

And the permissions of the file, such as, are set by three aspects:

The permissions of the user to which the current file belongs.

The permissions of the user group to which the current user belongs.

Permissions for other users.

(Anti-Theft connection: This article starting from http://www.cnblogs.com/jilodream/)

Note that the order of the three is also fixed.

such as the total permissions of the current file

R--rw-r-x, converted into numbers is 4 (r--) 6 (rw-) 5 (r-x)

Typically, a file has 777 permissions, which means that the owning user, the owning user group, and other users have rwx permissions.

Permissions for files under Linux

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.