Permissions for Linux directories

Simulation environment:

write picture description here

The permissions of the test directory are rwxr-xr-x

IanA user (rwx) readable and writable executable:

cd to the test directory is equivalent to executing the test directory file. 
write picture description here

Read the test directory file. 
write picture description here

Renaming, creating, and deleting files is equivalent to writing to the test directory file. 
write picture description here

IanB user (rx) readable and non-writable executable:

For the test directory file, you can cd to the test directory (executable) and ls (readable). Could not create file (not writable).

write picture description here

The permissions of the test directory are rw-x-x

Modify the test directory permissions: 
write picture description here

IanA user (rw-) readable, writable but not executable:

Without execute permission, you cannot cd to the test/ directory. 
Although the permissions are readable and writable, in fact, ls can only see the file name and cannot delete the file. 
write picture description here

IanB user (-x) is not readable, not writable and executable:

write picture description here

Same for Lisa users.

To summarize the test conclusions:

Instructions for read, write, and execute permissions of the linux directory:

  • Readable r: indicates that it has the permission to browse files and subdirectories under the directory, that is, ls dir. If you don't have x permission, you can't enter the directory. You can see all the file names in the ls list, but you will be prompted that you don't have permission to access the files in the directory. If ls -l lists, all attributes will have question marks, and it will also prompt that you do not have permission to access files in the directory, but you can see all file names.
  • Writable w: Indicates the permission to add, delete or modify the file name in the directory (requires the permission of x).
  • Executable x: Indicates permission to enter the directory, such as cd dir. But there is no list without r, and creation and deletion without w.

Linux file and directory permissions comparison instructions:

Readable r:

  1. For files, it means having the permission to read the contents of the file.
  2. For a directory, it means that it has the permission to browse the files and subdirectories under the directory. If you do not have x permission, you can see all file names in the ls -l list, but all the attributes of the file have question marks, indicating that you do not have permission to access the files in the directory.

w can be written:

  1. For a file, it indicates the permission to add or modify the content of the file. Deletion has nothing to do with moving the file and the properties of the file itself.
  2. For a directory, it means that it has the permission to add, delete, and move files in the directory, which requires the cooperation of x permission.

executable x:

  1. For files, it means having the permission to execute the file. Ordinary users also need to have r permissions, and root users can execute without r.

  1. For a directory, it means that it has permission to enter the directory, but it cannot be listed without r, and cannot be created without w.

Reprinted to https://blog.csdn.net/codetz/article/details/52471294

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325806000&siteId=291194637
Recommended