我想更改 Centos 4 上树的权限,以从目录递归地添加所有目录的执行权限。如果我使用普通的 chmod,目录以外的文件也会被修改:
chmod -R o+x /my/path/here
Run Code Online (Sandbox Code Playgroud)
我怎样才能只影响目录?
Dan*_*eck 57
与主要find在-type d(目录)上运行-exec以chmod对文件夹执行唯一的操作:
find /your/path/here -type d -exec chmod o+x {} \;
Run Code Online (Sandbox Code Playgroud)
为了确保它只在所需的对象上执行它,您可以先运行find /your/path/here -type d;它会简单地打印出它找到的目录。
小智 22
请参阅维基百科中的命令行示例 - chmod。
# Remove the execute permission on all files in a directory
# tree, while allowing for directory browsing.
chmod -R a-x+X directory
Run Code Online (Sandbox Code Playgroud)
正如丹尼尔补充的那样:这应该适用于您的情况:
chmod -R o+X directory
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
44111 次 |
| 最近记录: |