加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

unix – chmod:无法读取目录`.’:权限被拒绝[已关闭]

发布时间:2020-12-15 18:47:01 所属栏目:安全 来源:网络整理
导读:我正在尝试递归地更改“data”目录的目录和子目录的权限,并运行到以下错误中.有人可以在以下错误中提供输入? username:/local/mnt/workspace/datachmod -R 0644 .chmod: cannot read directory `.': Permission denied 目录需要执行权限集才能查看其内容.
我正在尝试递归地更改“data”目录的目录和子目录的权限,并运行到以下错误中.有人可以在以下错误中提供输入?
<username:/local/mnt/workspace/data>chmod -R 0644 .
chmod: cannot read directory `.': Permission denied
目录需要执行权限集才能查看其内容.

从http://content.hccfl.edu/pollock/AUnix1/FilePermissions.htm

You can think of read and execute on directories this way: directories are data files that hold two pieces of information for each file within,the file’s name and it’s inode number. Read permission is needed to access the names of files in a directory. Execute (a.k.a. search) permission is needed to access the inodes of files in a directory,if you already know the file’s name.

当您将目录权限更改为644时,您无法读取该目录中的文件,尽管您可以读取该目录以查看该目录的存在.

你需要这样做:

$chmod -R 0755 .

一个更好的方法可能是使用字符串权限,如果你只想关闭

否则,您可以看到目录,但不能访问该目录中的信息.

你最好使用相对权限而不是绝对权限:

$chmod -R go-w .

将删除组和其他的写入权限,但不触摸执行权限.

您也可以使用find来设置目录或仅设置文件:

$find . -type d -exec chmod 755 {} ;

这只会触及目录,为所有目录设置读取和执行权限,并为所有者设置写入权限.这样,您不会对文件本身设置执行权限.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读