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

我正在尝试递归地更改“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 {} \;

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

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...