Linux 权限,X 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5790846/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 03:49:49  来源:igfitidea点击:

Linux permission, what is the X?

linuxpermissions

提问by Damiano

If I set 751 to a directory, the permission are: drwxr-x--x

如果我将 751 设置为目录,则权限为: drwxr-x--x

the "x" what does it mean? If i set that permission means anyone could access to this directory but ONLY the owner and the GROUP could read the contents?

“x”是什么意思?如果我设置该权限意味着任何人都可以访问此目录,但只有所有者和 GROUP 可以读取内容?

Let me know, thank you

告诉我,谢谢

回答by sashoalm

It means 'execute' permission. For a directory it has a more interesting meaning. Execute permission on a directory means you can list the files in that directory. See here. From the link I posted:

这意味着“执行”权限。对于目录,它具有更有趣的含义。目录的执行权限意味着您可以列出该目录中的文件。见这里。从我发布的链接:

Remember that to read a file, you need execute access to the directory it is in AND read access to the file itself. To write a file, your need execute access to the directory AND write access to the file.

请记住,要读取文件,您需要对其所在目录的执行访问权限以及对文件本身的读取访问权限。要写入文件,您需要执行对目录的访问和对文件的写访问。

回答by Cédric Julien

the x means "executable".

x 表示“可执行”。

in your example, the owner can read an write into the directory, the group users can only read, but everyone can go inside.

在您的示例中,所有者可以读取对目录的写入,组用户只能读取,但每个人都可以进入。

回答by Johanna Larsson

The x means you can cdto the directory. The r means you can lsthe directory.

x 表示您可以cd访问该目录。r 表示您可以访问ls该目录。

回答by gd1

The execute 'x' permission, when set for a directory, grants the ability to traverse its tree in order to access files or subdirectories, but not see the content of files inside the directory (unless read 'r' is set). (*)

为目录设置执行“x”权限时,授予遍历其树以访问文件或子目录的能力,但不能查看目录内文件的内容(除非设置了读取“r”)。(*)

So in your example, owner, group and others can do anything, group can cdinto the directory and ls(read the list of the files within), others can just cdinto the directory to access subdirectories, but that's quite an useless permission without "read".

因此,在您的示例中,所有者、组和其他人可以做任何事情,组可以cd进入目录并ls(读取其中的文件列表),其他人可以cd进入目录以访问子目录,但如果没有“读取”权限,这是非常无用的权限.

(*) See http://en.wikipedia.org/wiki/Filesystem_permissions#Permissions

(*) 见http://en.wikipedia.org/wiki/Filesystem_permissions#Permissions