Linux Basic Permissions (i)

Source: Internet
Author: User
Tags file permissions

1. Permissions Concept

[Email protected]:/home# ll Total dosage20
# File Permissions Link Number file owner user group capacity size B Create (Modify) time file name
drwxr-xr-x5Root root4096November - +: +./drwxr-xr-x -Root root4096November - +: -.. /drwxr-xr-x atHang Hang4096November - -: -hang/drwxr-xr-x2Zncu Zncu4096November - -: -zncu/Drwxrws---2Root Znha4096November - -: -znha/

Use LL (ls-l) to view a list of the contents of this directory, such as:D rwx r-x R-x, which represents the permissions for this directory or file. In simple terms, r means readable, W is writable, and X is executable.

    • The first column indicates the type of the file
      • D: Indicates that this file is a directory
      • -: Indicates that this file is a file
      • L: Indicates this file is a connection file
      • B: An excuse device that represents the storage in the device file
      • C: Indicates the serial port device inside the device
    • The first set of RWX represents the file owner permissions.
    • The second set of RWX represents the same user group permissions as the file owner.
    • The third group of RWX represents the other person's permissions, not the file owner or the consent user group, or others.
    • About the size of the file here is 4096B, this and the Linux file system, not to mention.

2. Effects of RWX permissions on directories and files

 Directory:

R: Indicates that you have permission to read the directory, the direct effect is that you can use the LS command to print the directory contents list.

W: Represents a permission to change the list of the directory structure, such as new, delete, rename, move, and so on. The overall change in the file name is not the change in the contents of the document.

X: Indicates whether you can enter this directory.

[Email protected]:~/hang$ ll
D-wxrwxr-x 2 hang hang 4096 November 19:34 A/#缺少r权限

[Email protected]:~/hang$ ll/ #不允许使用ls命令查看该目录内容
LS: Unable to open directory ' A/': Insufficient permissions
[Email protected]:~/hang$ CD/# to enter this directory


As you can see, for-wxrwxr-x permissions on directory A, the directory owner does not have R permissions. You cannot view the contents of this directory, but you can go in because you have X permissions.

[Email protected]:~/hang$ Lldr-xrwxr-x2Hang Hang4096November -  +: theA/# Missing W Permissions[email protected]:~/hang$ CD A/[email protected]:~/hang/a$ ll # can enter and view the directory-rw-rw-r--1Hang Hang0November -  +: the 1[email protected]:~/hang/a$ RM-RF1 # not allowed to delete 1 files in this directoryRM: Cannot delete'1': Insufficient permissions [email protected]:~/hang/a$

At this point, you are missing the W permission to the directory and can now enter and view the directory. However, the delete file operation is not allowed.

  File:

R: Can read the contents of the file

W: can edit the contents of the modified file, note but cannot delete, because this is the Directory permission control, need to own the W permission of the directory.

X: Executable. Linux does not want Windows to have an. exe suffix, whether the file can be executed with X permission, of course, can not be executed successfully to say otherwise.

 About the permissions of files and directories, can be explained from the Linux file system, this article will not say. It is important to note that the W permission for the directory.

Http://www.cnblogs.com/yuhanghzsd/p/6107144.html

Linux Basic Permissions (i)

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.