Linux Basic system permissions

Source: Internet
Author: User
Tags chmod file permissions

Linux Base system Permissions file permissions

Linux, each file has three kinds of permissions

Permissions impact on a file impact on the directory
R (Read) can read files Catalog contents can be listed
W (write) Can modify the contents of the file Delete files can be created in the directory
X (Execute) Can modify the contents of a file Access to directory content

Note : The directory must have X permissions, or it will not be able to view its contents

UGO

Linux permissions are controlled based on the UGO model

    • U on behalf of user, G for group, O on behalf of other
    • Permissions for each file are set based on Ugo
    • Permissions three a group (RWX), corresponding Ugo set separately
    • Each file has an owner/user (user), the group that the users belong to (group), does not belong to the above is the other

Command Ls-ls to view information about files in the current directory

Here's a concrete example.

Permissions Number of links owned by owning Group File Size Last Modified Time name
-rwrw-r-- Number of links Nothi Nothi 4 26 20:59 Test
Number of links is 1 (hard link) Owned by Nothi Owning Group is Nothi Size is 4 bytes Last modified on August 26 The file is called Test.

Where-rw-rw-r--the meaning is as follows

Owner Permissions have group permissions other people's rights
-rw -rw r--
Owner has read and write permissions Members of the owning group have read and write permissions Other people only read the permissions
Modify the properties of a file Chown

Chown the user file, modify the owner of the specified file to the specified user, such as Chown Nothi test.

-R parameter recursively modifies all the files in the directory for all users

Chgrp

The usage is similar to Chown

CHGRP group file, modify all groups of the specified file to the specified group, such as Chgrp Nothi test.

-R parameter recursively modifies the owning group of all files under the directory

Note : These two commands require root privileges

chmod

Modify the permissions of the file, the mode of the command is as follows: chmod mode file

General modification Methods

The format of the pattern is as follows

    • U,g,o represents users, groups, and other
    • A (All) represents all (Ugo)
    • +,-, each delegate to join and delete the corresponding permission
    • R, W, X for three kinds of permissions

pattern Example

Example meaning
chmod u+x Test Add execute permission to the owner
chmod g+r Test Add Read permission to the owning group
chmod a+w Test Add Write permission to a person
Digitally modified

Use digital 4,2,1 to represent R,W,X permissions respectively

When using numbers to represent permissions, each group of permissions corresponds to the sum of the numbers, for example, rw=4+2=6,rwx=4+2+1=7

To change the file test, the permission to Rwxrwxr-x, the command to chmod 775 test

Originally from: http://blog.csdn.net/nothi/article/details/10364643

Linux Basic system permissions

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.