linux中root使用者無法刪除某個檔案的解決方法

root使用者登入,刪除檔案:

rm -f  a.txt

刪除不了,提示:

rm: cannot remove 'a.txt': Opreation not permitted

檢視許可權:

ls -l a.txt
-rwxr--r-- a.txt root root

發現root 使用者 有執行檔案的許可權
再使用 lsattr   命令檢視許可權:

lsattr a.txt
---i------------ a.txt

發現有一個 i 許可權,百度檢視此許可權,發現 I 許可權如下:
不能被刪除、改名、設定連結、寫入或新增資料;
使用   命令撤銷 i 許可權:

chattr -i a.txt

再檢視:

lsattr a.txt
--------------- a.txt

此時再刪除:

rm -f  a.txt

刪除成功。
本文來源:http://blog.csdn.net/ye1142262478/article/details/51152228

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha Code