我以 root 身份运行此程序,而没有先设置正确的文件夹。 不用说,它开始重置 cpanel 服务器根目录中所有文件的权限。
lethost 的支持人员很快就帮我们安排好了 (10/10) 但我想知道是否可以修改这样的脚本来“指定路径” 而不是您当前所在的任何文件夹。
find . -type d -print -exec chmod 750 {} \; && find . -type d -print -exec chown user:nobody {} \; && find . -type f -print -exec chmod 644 {} \; && find . -type f -print -exec chown user:user {} \;
有人知道该怎么做吗?
最佳答案
find 的第一个命令行参数是您搜索的路径。在本例中,它是 .
,即当前工作目录。如果将其更改为不同的路径,则会搜索该路径:
find $YOUR_DIRECTORY -type d .....
关于bash - 自定义 Bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16859449/