
我有以下輸出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
我登入的身份為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/
答案1
在這種情況下,檔案所在的目錄具有重要的寫入權限。因此,如果您可以寫入該目錄,您也可以刪除其中的檔案。