删除文件的时候,发现有个文件一直删除不掉。
切换到root更改文件属性时,提示 Operation not permitted
Google了一下,发现原来是文件属性里有-i这个标志
# lsattr
—-i————- ./config
$man chattr
…
A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be
created to this file and no data can be written to the file. Only the superuser or a process pos-
sessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
去掉-i的属性只需用chattr -i 就可以了。
# chattr -i config
# rm -rf 1 config
;相反如果你想把某个文件加上-i属性,可以这样:
chattr +i fileName
;这样这个文件就不会被误删或者被修改了。
标签存档: linux无法删除文件
Linux下无法删除文件的解决办法之一
作者: NaRiver
日期: 九月 6, 2008
没有评论
逃离北上广
NaRiver Blog
最近留言