日期:2014-05-16  浏览次数:21241 次

文件删不掉 Operation not permitted
在CentOS下,想删除/var/log/httpd的一些文件,不能成功。
rm -f d 提示 rm: cannot remove `d': Operation not permitted

当前账户是root, ls -l d 的结果:
-rw-r--r--. 1 root root 0 Dec 26 10:06 d

lsattr d 的结果
-----a-------e- ./d

另外:
cp d e
e文件能创建成功, 但e文件又不能被删除了。


还有yum update httpd也不成功,有一个错误提示:
error: unpacking of archive failed on file /var/log/httpd: cpio: lsetfilecon

怎么才能删除这些文件呢?

------解决方案--------------------
mark
以前还真没碰到过
------解决方案--------------------
A file with the `a' attribute set can only be open in append mode for
writing. Only the superuser or a process possessing the
CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

chattr -a d试试先
------解决方案--------------------
学习学习 chattr

完全是这家伙在作怪
------解决方案--------------------
首先,同意#5和#7,如果lsattr查看有a权限,显然是无法删除的……
另外,抛开这种特殊权限的影响,文件能否被删除,是由文件所在的目录决定的,如果目录对某个用户没有w权限,文件一样无法删除……
------解决方案--------------------
该文件的上层目录lsattr看看属性