Linux File Attribute Awareness

Source: Internet
Author: User


Linux system is a typical multi-user operating system, different users are in different positions, have different permissions, we can view through the Ls-l

[Email protected] cron.daily]# ll/total 104dr-xr-xr-x.   2 root root 4096 Sep 11:15 bindr-xr-xr-x. 4 root root 4096 Sep 10:03 boot ...

In the above, the first property of bin is denoted by D, and "D" is the meaning of the directory file in the Linux system.

Careful observation we can see a total of 11 characters, the first character will appear as follows:

Start with "D": Catalog file

"-" begins with: file

"L" Start: Soft Connection file

Start of "B": Block device

"C" Start: Character device

The following 10 for the characters are represented separately:

Dr-xr-xr-x. : User Rights

Dr-xr-xr-x. : Group Permissions

Dr-xr-xr-x. : Other user rights

dr-xr-xr-x . :     hidden ACL permissions

It is often mentioned that 777 of the highest permissions, 755/644 permissions, in fact, are easy to understand, we add and subtract to associate:

Let's first define the associated permission rules:

R-->read=4 All rights

w-->write=2 Write permissions

X-->excute=1 Execute Permissions

So what does 777 mean?

The first 7 is calculated as the above rule equals those added? The answer is obvious 4+2+1=7

So what's the second one? What about the third one? Is it easy to understand that it is the permissions of the 4+2+1= group 4+2+1= the rights of other users to integrate them together? Not just rwxrwxrwx so easy!.

What about 755? Rwxr-xr-x 644? rw-r--r-- Note that the first character--is that the file behind it is empty, that is, no meaning.

The right to introduce, we introduce the next

Dr-xr-xr-x. 2 root root 4096 Sep 11:15 bin

What are the 2 root root 4096, respectively?

[[email protected] jr855]# lltotal 0-rw-r--r--.  1 root root 0 sep 22 16:56 11.txt[[email protected] jr855]#  ln -s 11.txt 1.txt[[email protected] jr855]# lltotal 0-rw-r--r--.  1 root root 0 Sep 22 16:56 11.txtlrwxrwxrwx. 1 root  root 6 sep 22 17:47 1.txt -> 11.txt[[email protected] jr855]#  ln 11.txt 2.txt[[email protected] jr855]# lltotal 0-rw-r--r--.  2  root root 0 sep 22 16:56 11.txtlrwxrwxrwx. 1 root root  6 sep 22 17:47 1.txt -> 11.txt-rw-r--r--.  2 root root  0 sep 22 16:56 2.txt[[email protected] jr855]# 

The above earnest discovery, the clever you may have discovered the mystery, the soft connection does not increase his number (Ln-s for soft connection, we can also find "L" from the first bit)

-rw-r--r--. 1 root root 0 Sep 16:56 11.txt Here 11.txt is a file and represents the user root and group root It's permissions are 644, normal people understand that users can read and write cannot be executed, Groups can be read and not written, other users can read and write



At this point, the simple file attributes are complete.

This article is from the "12087328" blog, please be sure to keep this source http://12097328.blog.51cto.com/12087328/1855540

Linux File Attribute Awareness

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.