hjp*_*r92 7 linux sudo permissions rm
我有以下输出ls -lFh:
-rw-r--r-- 1 hjpotter92 hjpotter92 926 Aug 2 18:40 static.yaml
drwxr-xr-x 5 hjpotter92 hjpotter92 4.0K Sep 12 19:40 templates/
-rw-r--r-- 1 root root 1.5K Sep 12 20:09 xyz
Run Code Online (Sandbox Code Playgroud)
我以hjpotter92. 我的用户NOPASSWD在sudoers列表中没有条目。有人可以解释我尝试以下操作时的行为:
$ which rm
rm: aliased to rm -i
$ rm xyz
rm: remove write-protected regular file 'xyz'? y
$ sudo rm xyz
rm: cannot remove 'xyz': No such file or directory
$ ls -lFh
total 176K
<a lot of other files>
-rw-r--r-- 1 hjpotter92 hjpotter92 926 Aug 2 18:40 static.yaml
drwxr-xr-x 5 hjpotter92 hjpotter92 4.0K Sep 12 19:40 templates/
Run Code Online (Sandbox Code Playgroud)
Jar*_*era 14
在这种情况下,文件所在的目录具有重要的写权限。所以如果你可以写目录,你也可以删除那里的文件。