我已经从几天开始学习Linux了,现在我在File Parmissions上用粘滞位,我尝试了以下内容:
[root@localhost sdcdir]# ll total 24 drwx------. 2 root root 16384 Mar 21 21:38 lost+found drwxrws--T. 2 root g1 4096 Mar 23 01:22 testdir
g1是Pavan,Sudheer和Surendra成员,Surendra是组pipe理员(即gpasswd -A Surendra)
现在,Pavan在testdir中创build一个文件p1:
[Pavan@localhost testdir]$ touch f1 [Pavan@localhost testdir]$ ll total 0 -rw-rw-r--. 1 Pavan g1 0 Mar 23 01:33 f1 [Pavan@localhost testdir]$
当我试图用Surendra帐户删除它时,我收到错误:
[Surendra@localhost sdcdir]$ cd testdir/ [Surendra@localhost testdir]$ ll total 0 -rw-rw-r--. 1 Pavan g1 0 Mar 23 01:33 f1 [Surendra@localhost testdir]$ rm f1 rm: cannot remove `f1': Operation not permitted [Surendra@localhost testdir]$
文件f1有g1作为组所有者,但除了Pavan自己以外,文件不能被删除。 setgid时,group被设置为所有者,为什么不能删除这个文件?
我想你正试图删除sdcdir中的f1(它的权限是什么?),而不是在testdir中。 这可能是你的问题。 在这种情况下,f1由root拥有,只有拥有者(root)拥有写权限,而uid不为0的用户将不能删除它。
要删除文件,您必须同时拥有对其目录的写入和执行权限。