Home > Operation and Maintenance > Linux Operation and Maintenance > Discussion on the issue of x execution permission of directories under Linux

Discussion on the issue of x execution permission of directories under Linux

巴扎黑
Release: 2017-08-23 15:48:40
Original
1718 people have browsed it

Example question:

There is a directory with the permissions as follows:

drwxr--r-- 3 root root 4096 Jun 25 08:35 .ssh

System There is an account named vbird. This account does not support the root group. What permissions does vbird have on this directory? Is it possible to switch to this directory?

Answer: vbird only has r permission on this directory, so vbird can query the file name list in this directory. Because vbird does not have x permissions, vbird cannot switch to this directory! (A very important concept!)

In the above example, because vbird has the permissions of r, it seems that r has the permissions to enter this directory at first glance. In fact, that is wrong. Whether you can enter a certain directory is only related to the x permission of the directory! In addition, the working directory is very important for the execution of instructions. If you do not have x permissions in a certain directory, then you cannot switch to that directory, and you cannot execute any instructions in that directory, even if you have the The permissions of r on the directory.

Many friends get stuck on some permission settings when setting up a website. They open directory information for anyone on the Internet to browse, but only open r permissions, as shown in the example above. In that case, the result is that the website server software cannot read the files in the directory (at most, it can only see the file name), and the end user is always unable to correctly access the contents of the file (the display permissions are insufficient!). Note: When you want to open a directory for anyone to browse, you should at least give it r and x permissions, but you cannot give w permissions casually!

Because: If user A does not have any permissions on a file, but has w permissions on the directory where the file is located, user A can still delete the file.

The above is the detailed content of Discussion on the issue of x execution permission of directories under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template