几个星期以来,我无法弄清楚为什么我无法删除这个特定文件.
作为root我可以,但我的shell脚本作为不同的用户运行.所以我去运行ls -la并且它不在那里.但是,如果我将其称为参数,它会显示出来!果然,所有者是root,因此我无法删除.
注意,6535丢失了……
[root@server]# ls -la 653*-rw-rw-r-- 1 svn svn 24002 Mar 26 01:00 653-rw-rw-r-- 1 svn svn 7114 Mar 26 01:01 6530-rw-rw-r-- 1 svn svn 8653 Mar 26 01:01 6531-rw-rw-r-- 1 svn svn 6836 Mar 26 01:01 6532-rw-rw-r-- 1 svn svn 3308 Mar 26 01:01 6533-rw-rw-r-- 1 svn svn 3918 Mar 26 01:01 6534-rw-rw-r-- 1 svn svn 3237 Mar 26 01:01 6536-rw-rw-r-- 1 svn svn 3195 Mar 26 01:01 6537-rw-rw-r-- 1 svn svn 27725 Mar 26 01:01 6538-rw-rw-r-- 1 svn svn 263473 Mar 26 01:01 6539
现在它显示你是否直接调用它.
[root@server]# ls -la 6535-rw-rw-r-- 1 root root 3486 Mar 26 01:01 6535
这里有一些有趣的东西.所以我发现了这个问题,因为在我的shell脚本中,它将无法删除,因为6535由root拥有.运行“rm -rf”后,文件实际显示出来.我之前尝试过,它无法删除目录,因为它告诉我目录不是空的.我进去看了看,肯定的是,文件“6535”终于出现了.不知道为什么会这样做.
strace说以下
#strace ls -la 653* 2>&1 | grep ^openopen("/etc/ld.so.cache",O_RDONLY) = 3open("/lib64/tls/librt.so.1",O_RDONLY) = 3open("/lib64/libacl.so.1",O_RDONLY) = 3open("/lib64/libselinux.so.1",O_RDONLY) = 3open("/lib64/tls/libc.so.6",O_RDONLY) = 3open("/lib64/tls/libpthread.so.0",O_RDONLY) = 3open("/lib64/libattr.so.1",O_RDONLY) = 3open("/etc/selinux/config",O_RDONLY) = 3open("/proc/mounts",O_RDONLY) = 3open("/usr/lib/locale/locale-archive",O_RDONLY) = 3open("/proc/filesystems",O_RDONLY) = 3open("/usr/share/locale/locale.alias",O_RDONLY) = 3open("/usr/share/locale/en_US.UTF-8/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/usr/share/locale/en_US.utf8/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/usr/share/locale/en_US/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/usr/share/locale/en.UTF-8/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/usr/share/locale/en.utf8/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/usr/share/locale/en/LC_TIME/coreutils.mo",O_RDONLY) = -1 ENOENT (No such file or directory)open("/etc/nsswitch.conf",O_RDONLY) = 3open("/etc/ld.so.cache",O_RDONLY) = 3open("/lib64/libnss_files.so.2",O_RDONLY) = 3open("/etc/passwd",O_RDONLY) = 3open("/etc/group",O_RDONLY) = 3open("/etc/mtab",O_RDONLY) = 3open("/proc/meminfo",O_RDONLY) = 3open("/etc/localtime",O_RDONLY) = 3解决方法 这有点令人担忧.我将通过与已知正常文件进行比较来验证您的ls文件未被修改.您可以使用发行版的包工具来验证隔离系统上的文件. 总结
以上是内存溢出为你收集整理的linux – 为什么在运行ls时隐藏此文件?全部内容,希望文章能够帮你解决linux – 为什么在运行ls时隐藏此文件?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)