Permissions issues under Linux

Source: Internet
Author: User

Just now the manager told me about the authority of the problem, I also collected on the internet after the next, special note in this.

-----------------------------------------------------------------------------------------------

Each file and directory in the Linux system has access permissions and is used to determine who can access and manipulate files and directories. Access to a file or directory is divided into read-only, write-only, and executable three types.

  

When a file is created, the file owner automatically has read, write, and execute permissions on the file to facilitate the reading and modification of the file. Users can also set access rights to all the combinations they need, as needed.

There are three different types of users who can access files or directories: The file owner, the same group of users, and other users. The owner is typically the creator of the file. The owner can allow the same group of users access to the file, as well as the access rights of the file to other users on the system . In this case, every user in the system can access the files or directories that the user owns.

Each file or directory has three groups of access rights, each group is represented by three bits, respectively, the read, write, and execute permissions of the file owner, and the read, write and execute permissions of the user belonging to the primary group, and the read, write, and execute permissions of other users in the system.

In Linux file and directory permissions, you can use the command ll or ls-l to display the details of a file or directory, the leftmost column is the file's access rights.

Linux file permissions are divided into three categories (mutually exclusive relationships) for objects:

1. User (owner of the file)

2. Group (where the file owner resides, but does not include user)

3. Other (other users, other than user and group)

Linux uses a 3-bit binary number to correspond to the 3 permissions of the file (1 indicates that the permission is available and 0 means none):

1th bit read R 100 4

2nd bit write W 010 2

3rd digit Execution x 001 1

View Permissions command: # ll or ls-l

The first column, altogether 10 bits (DRWXRWXRWX), represents the permissions of the file:

1) The first d represents a directory, and if "-" is displayed, then the description is not a directory

2) 2-4 represents the user's permissions

3) 5-7 for group permissions

4) 8-10 on behalf of other permissions

For the latter 9 bits:

R stands for readable (read) with a value of 4

W stands for writable (write) with a value of 2

X represents an executable (execute) with a value of 1

-The delegate has no corresponding permission, the value is 0

Modify file Permissions command: # chmod [ugoa][+-=][rwx] File name

1) User

U on behalf of user

G represents group

O on behalf of other

A represents all people, including U,g and O.

2) Action

+ means add permission

-Indicates delete permission

= indicates a permission to make it unique

3) Permissions

RWX can also be used in digital notation, but it's up to you, like rw=6.

Common permissions:

-rw?? (600) Only the owner has read and write permissions

-rw-r?? R?? (644) Only the owner has read and write permissions, and the group and other people have only Read permissions

-rwx?? (700) Only the owner has read, write, and Execute permissions

-rwxr-xr-x (755) Only the owner has read, write, execute permissions, groups and other people only read and Execute permissions

-rwx?? X?? X (711) Only the owner has read, write, execute permissions, groups and other people only execute permissions

-rw-rw-rw-(666) Everyone has access to read and write

-RWXRWXRWX (777) Everyone has read-write and Execute permissions, maximum permissions.

To modify the commands of the group that belong to and belong to the host: #chown
To modify the owner of MyFile to Tina, use: #chown Tina MyFile
To change the group where the owner of the file belongs to the Smallstop group, use: #chown. Smallstop myfile
And in one piece is: #chown tina.smallstop myfile

    

Delete files, only the current directory has RW permissions.

     

The manager also talked about the Linux system in the design of a disadvantage, is that the file owner can modify permissions. Only the root user can modify permissions on Windows. (Pending Amendment)

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.