我从几天开始学习Linux,现在我正在学习设置UID,GID和粘滞位等高级文件权限。 在根目录下,我首先将目录的所有权更改为Pavan和g1组,然后执行以下操作:
[root@localhost sdcdir]# ll total 20 drwx------. 2 root root 16384 Mar 21 21:38 lost+found drw-r----T. 2 Pavan g1 4096 Mar 22 11:41 testdir [root@localhost sdcdir]# chmod 4660 testdir/ [root@localhost sdcdir]# ll total 20 drwx------. 2 root root 16384 Mar 21 21:38 lost+found drwSrw----. 2 Pavan g1 4096 Mar 22 11:41 testdir
以Pavan身份login后,我无法在该目录上使用CD或Ls,出现以下错误:
[Pavan@localhost sdcdir]$ ll total 20 drwx------. 2 root root 16384 Mar 21 21:38 lost+found drwSrw----. 2 Pavan g1 4096 Mar 22 11:41 testdir [Pavan@localhost sdcdir]$ cd testdir/ bash: cd: testdir/: Permission denied [Pavan@localhost sdcdir]$
你能指导我哪里出了问题吗? 谢谢。
目录需要执行权限( x
)才能input。 尝试
chmod 4770 testdir/
代替。
如果您想授予某人访问目录但不能(轻松)浏览其内容的权限,您可以授予只有执行权限,并且完全不授予读取权限:
chmod 4110 testdir/
http://en.wikipedia.org/wiki/File_system_permissions
执行位…当为目录设置时,此权限授予遍历树的能力,以访问文件或子目录,但不能查看目录内的文件内容(除非设置了读取)。
因此你需要“chmod 4770 testdir”
HTH