Linux common commands (2)

Source: Internet
Author: User

Set permissions for directories and files under Linux

When you set permissions on files and directories, you first need to know what the three digits of the Liunx permission mode mean.

Example 777 this three number, the first one represents the owner group others all the permissions. Owner-owned permissions, permissions owned by group users, and permissions owned by other users.

In Linux permissions 1=x Execute permissions 2=w Write permissions 3=r read the permission to see the above three data respectively is 7, 7, 7 this 7=1+2+3 represents have to execute, write, read three kinds of permissions. To join us to three roles is only execute, write permission, then this number should be 333 because 3=1 +2 performs the Write permission.

Let's take a look at the command statement that changes the file permissions Chmod 777 File|dir-r This later parameter we can view all the files in the directory by the LL command with the permissions of the three roles.

The-r parameter recursively changes the genus of the specified directory and all subdirectories and files under it.

Permissions can be changed by means of a digital grant when granting permissions. You can also change permissions by using text-giving methods.

1 Digital settings

Mode refer to the above three numbers name file name

# chmod Mode Name

You can view the permissions of a file by command #ls-l

2 text Settings

Command format: # chmod [who] [+ | –| =] [mode] filename?

Use text to set permissions need to understand U (file owner) g (file user group) O (Other user) a (all users)

Need to understand X (Execute permission), W (Write permission), R (Read permission)

The operation symbols can be:
+ Add a permission.
-Cancels a permission.
= gives the given permission and cancels all other permissions, if any.

Linux common commands (2)

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.