我正在使用 Ubuntu 11.10 Gnome。
我卸载了 snort 以安装更新版本。新安装最初失败,因为系统不允许 rm 或修改 /var/log/snort,即使以 root 身份也是如此。
sudo chattr -i /var/log/snort/*
使我能够删除 /var/log/snort 的内容,尽管 i 属性似乎尚未设置。
然而,尽管只设置了 e 属性,但sudo chattr -i /var/log/snort
不允许我删除自身。/var/log/snort
我能够更改所有权,/var/log/snort
但这没有帮助
peter-Inspiron-620:/var/log$ ls -ld /var/log/snort
drwxrws--- 2 root adm 4096 2013-05-20 23:22 /var/log/snort
peter-Inspiron-620:/var/log$ sudo rmdir /var/log/snort
[sudo] password for peter:
rmdir: failed to remove `/var/log/snort': Operation not permitted
peter-Inspiron-620:/var/log$ sudo rm -rf /var/log/snort
rm: cannot remove `/var/log/snort': Operation not permitted
peter-Inspiron-620:/var/log$ sudo chown peter /var/log/snort
peter-Inspiron-620:/var/log$ ls -ld /var/log/snort
drwxrws--- 2 peter adm 4096 2013-05-20 23:22 /var/log/snort
peter-Inspiron-620:/var/log$ rmdir /var/log/snort
rmdir: failed to remove `/var/log/snort': Permission denied
peter-Inspiron-620:/var/log$ rm -rf /var/log/snort
rm: cannot remove `/var/log/snort': Permission denied
peter-Inspiron-620:/var/log$
我尝试重新启动计算机并以恢复模式进入 root shell,但仍然无法删除该目录。
答案1
您可以使用以下命令查找目录中的当前实例
lsof +D /var/log/snort
这将帮助您找出正在使用您正在搜索的目录中存在的文件的当前进程(在您的情况下是/var/log/snort
.
答案2
检查是否有其他进程正在访问该文件:
sudo fuser /var/log/snort