SETUID 权限被拒绝

SETUID 权限被拒绝

我已经学习 Linux 几天了,现在我正在尝试学习高级文件权限,例如设置 UID、GID 和粘性位。在​​ root 下,我首先将目录的所有权更改为 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 身份登录后,我无法在该目录上使用 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]$ 

您能指导我哪里出错了吗?谢谢。

答案1

目录需求执行x允许你输入( )。尝试

chmod 4770 testdir/

反而。

如果您想授予某人进入目录的权限但不允许(轻松)浏览其内容,您可以只授予执行权限而不授予读取权限:

chmod 4110 testdir/

答案2

http://en.wikipedia.org/wiki/File_system_permissions

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

因此你需要“chmod 4770 testdir”

高血压

相关内容