<username:/local/mnt/workspace/data>chmod -R 0644 . chmod: cannot read directory `.': Permission denied
<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 {} \;
这只会触及目录,为所有目录设置读取和执行权限,并为所有者设置写入权限.这样,您不会对文件本身设置执行权限.