linux 目录 问号 原因,linux – 如何修复所有问号作为权限的目录

我正在使用CentOS 7并尝试列出目录的内容但不能.当我尝试列出内容时,我得到以下输出:

[entpnerd@myhost ~]$ls -ali /data/sharedlogs/otherhost/

ls: cannot access /data/sharedlogs/otherhost/vcs: Not a directory

total 12

2361284 drwxr-xr-x 4 root root 4096 Sep 26 14:40 .

2359297 drwxr-xr-x 6 root root 4096 Apr 26 17:41 ..

2362573 drwxr-xr-x 2 root root 4096 Mar 22 2017 tkr

? d????????? ? ? ? ? ? vcs

输出声明我的目录vcs是“Not a directory”,即使它应该是,因为这是以前记录过文件的地方.此外,文件权限位现在都是问题标记,所有者也是,并且(莫名其妙地)inode ID.

如何让文件系统再次将我的目录识别为目录?

在尝试了下面概述的所有内容之后,我看到的唯一前进路径是确保磁盘备份并运行fsck(如this forum所示)或者可能只是格式化整个安装.希望我找到一个更简单,不那么激烈的解决方案.

我试过的一些事情:

> sudo:我试过运行sudo ls但输出没有差别.

> rm:我试过删除vcs把它放回去但没有运气.我用sudo和没有尝试过这个,但也没有运气.奇怪的是,当我尝试sudo rm时,它声明是一个目录.我也试过rm同时使用-r和-d开关,也没有运气.我从rm命令尝试获得的输出是:

[entpnerd@myhost ~]$rm /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Not a directory

[entpnerd@myhost ~]$sudo rm /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Is a directory

[entpnerd@myhost ~]$sudo rm -r /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Is a directory

[entpnerd@myhost ~]$rm -r /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Not a directory

[entpnerd@myhost ~]$rm -rd /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Not a directory

[entpnerd@myhost ~]$sudo rm -rd /data/sharedlogs/otherhost/vcs

rm: cannot remove ‘/data/sharedlogs/otherhost/vcs’: Is a directory

> inode ID:我尝试通过inode删除(如this answer to a similar question所示),但我也没有运气,因为从上面的ls命令的输出可以看出,vcs目录没有inode ID.

>非ASCII字符:在帖子“How to Delete the Undeletable Directory”中,目录具有非ASCII字符.我从xxd输出中看到的情况也不是这样:

[entpnerd@myhost ~]$ls -l /data/sharedlogs/otherhost/ | xxd

ls: cannot access /data/sharedlogs/otherhost/vcs: Not a directory

0000000: 746f 7461 6c20 340a 6472 7778 722d 7872 total 4.drwxr-xr

...

0000040: 3f3f 3f3f 3f20 3f20 3f20 2020 203f 2020 ????? ? ? ?

0000050: 2020 2020 203f 2020 2020 2020 2020 2020 ?

0000060: 2020 3f20 7663 730a ? vcs.

> lsattr:正如类似问题“Why can’t I delete this file as root?”所示,我尝试使用lsattr命令,但没有运气:

[entpnerd@myhost ~]$lsattr /data/sharedlogs/otherhost/

-------------e-- /data/sharedlogs/otherhost/tkr

/data/sharedlogs/otherhost/vcs: Not a directory

[entpnerd@myhost ~]$lsattr /data/sharedlogs/otherhost/vcs

lsattr: Not a directory while trying to stat /data/sharedlogs/otherhost/vcs

[entpnerd@myhost ~]$sudo lsattr /data/sharedlogs/otherhost/vcs

[sudo] password for entpnerd:

lsattr: Not a directory while trying to stat /data/sharedlogs/otherhost/vcs

[entpnerd@myhost ~]$sudo chmod -R g+x /data/sharedlogs/otherhost/vcs

[sudo] password for entpnerd:

chmod: cannot access ‘/data/sharedlogs/otherhost/vcs’: Not a directory

[entpnerd@myhost ~]$sudo chmod -R u+x /data/sharedlogs/otherhost/vcs

chmod: cannot access ‘/data/sharedlogs/otherhost/vcs’: Not a directory

[entpnerd@myhost ~]$sudo chmod -R a+x /data/sharedlogs/otherhost/vcs

chmod: cannot access ‘/data/sharedlogs/otherhost/vcs’: Not a directory

任何帮助将不胜感激.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于一个使用者来说,文件权限是从安全的角度来看非常重要的考虑因素。Linux文件系统为每一个文件和目录都分配了不同的权限。但是当你使用命令ls -l时,你可能会看到这些权限中有一个问号。这是因为在这个位置上,缺少了某个重要的权限所以被标示为问号。 在Linux中,文件或目录权限分为三类:读、写和执行。对于文件而言,读权限只能被用来允许或禁止文件的阅读。写权限允许或禁止文件的编辑。执行权限通常用于可执行文件中,在控制流程中允许程序执行或不执行某段代码,对于文本文件这个权限往往没有任何用处。对于目录而言,阅读权限允许用户查看该目录中的文件名和其他信息;写权限允许用户创建、删除、或更改该文件夹中的文件名和其他信息;执行权限允许用户进入该目录,并访问它内部的文件。 在Linux中,当你看到一个问号显示在文件权限的某个位置上时,它意味着你无法访问该文件目录的某些权限,因为你不是该文件或目录的拥有者,或者你没有执行相应的操作使你能够访问它。如果你是文件或目录的所有者,你可以使用chmod命令来授予或撤销权限。如果你无法访问该文件或目录,则需要联系该文件或目录的所有者请求权限。 总之,文件或目录权限Linux系统中是非常重要的,一个问号表示你可能无法访问某些权限。为了根据需要管理和更改文件权限,你需要了解Linux文件权限的各种配置和条件,并遵循Linux文件权限的最佳实践来最大限度地保护你的系统免受未授权文件或目录访问的威胁。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值