2011/1/30 foolhunger <foolhun...@gmail.com>

> 比如:在对一个有r权限没有x权限的dir进行ls
> -l的时候,可以显示出dir里的文件名,但是相关属性都是???(本人用bash),个人的理解是没有x就不能访问inode,所以无法显示属性。
>

关于这点,在网上查了一下,找到一个解释,与你说的吻合. 具体看下文解释.页面链接为
http://content.hccfl.edu/pollock/aunix1/filepermissions.htm

> Execute Permission for Directories
>
> The chdir() system call is one of many that requires execute permission on
> a directory.  Of course a directory isn't really a program that you can run
> even if it has execute permission.  The execute bit is reused rather than
> waste space with additional permission bits.
>
> Besides controlling a user's ability to cd into some directory, the
> execute permission is required on a directory to use the stat() system
> call on files within that directory.  The stat() system called is used to
> access the information in a file's inode, and must be done before you can
> open or delete (via the unlink() system call) that file.  (See 
> Note<http://content.hccfl.edu/pollock/aunix1/filepermissions.htm#>.)
>
>
> Because of its role in file access the execute bit on a directory is
> sometimes called *search* permission.  For example, to read a file foo/bar,
> you must have read permission for the file itself, but before the file can
> be accessed you must first search the directory foo for the inode of file
> bar.  This requires search (x) permission on the directory foo.  (Note you
> don't need read permission on the directory in this case!  You only need
> read permission on a directory to list its contents.)
>
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: 
<https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110131/63cb7a75/attachment.html>
-- 
ubuntu-zh mailing list
ubuntu-zh@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh

回复