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