Kill lui lei dog---linux no:16 Linux file permissions

Source: Internet
Author: User

We normally use command chmod to set permissions, 777 although good, but many times there is a risk oh, hehe

chmod-----Change Permissions

Chown-----Change User Affiliation

We use an ordinary document to interpret it.

Three box content parsing:

First box: The current user-----have read and Write permissions

Second box: Users of this user group-----have read access

Third box:-----have Read permissions for other users ...

Then we go into the home directory and create a leigood directory to look at him:

First box:

D: is the abbreviation of dirtectory (directory)

Second box: User group permissions

Third box: Other user rights

First box: Number of hard links or directory subdirectories of a file

Second box: Owner of the file

Third box: The group where the owner of the file resides

Fourth box: size of File

Fifth box: month of file creation

Sixth box: File creation time

Seventh box: Name of the file

We can use the LL command in CentOS and Redhat as well as SuSE, and if not, then using Ls-l is actually the same as the final effect ...

Chmod:linux/unix's file access rights are divided into three levels: file owners, groups, and others. The use of chmod can be used to control how files are accessed by others.

We add the permissions to the file in the form of a character, as follows:

First use U to assign permissions to yourself

So we're giving the owner of the sword a permission to read and write ...

Then we use G to add permissions to the user group

Then we add permissions to the group that the user belongs to ...

Finally, we'll use O to add permissions to third-party users ....

Then add permissions to other users ....

If you need to subtract the privileges of a third-party user, it's simple, just use O to remove his permissions, and so on.

Using characters to control permissions has a weakness, that is, each time only a set of permissions can be modified, so the birth of a number of permissions to modify, and at the same time can modify the three groups of permissions.

So we use more of the array to control the permissions,

The Read permission is expressed in 4

Write permissions are expressed in 2

Execute permission is expressed in 1.

So they 4+2+1=7, this is more clear ...

Originally Leigood did not have any authority, then we use 742来 to express, this explains our

Owner user rights are read and write Execute permissions

Owning group is read permission

Third-party use is EXECUTE permission

Like 777, then everyone has read and write permission to execute ...

Chown the owner of the specified file to the specified user or group, the user can be either a user name or a user ID; a group can be a group name or a group ID; a file is a space-separated list of files to change permissions, and wildcard characters are supported. System administrators often use the Chown command to give users permission to use a file after copying it to another user's directory.

Then we add a new user

Because we added a new user, his name is the same as the owning group name,

Then we change the file of the group that belongs to the root directory to Lisi

Here we can easily see, through the chown will originally belong to the root user group to change to Lisi belongs to the group of ...

If I use a file chown root:root directory name, then Lisi this user can not do anything in the directory I specified, as shown in the following:

Kill lui lei dog---linux no:16 Linux file permissions

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.