sudo 없이 루트 소유 파일을 어떻게 제거할 수 있었나요?

sudo 없이 루트 소유 파일을 어떻게 제거할 수 있었나요?

나는 다음과 같은 결과를 얻었습니다 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

이 경우 파일이 있던 디렉터리에 대한 중요한 쓰기 권한이 있습니다. 따라서 디렉터리에 쓸 수 있으면 거기에 있는 파일을 제거할 수도 있습니다.

관련 정보