Bash SSH 更改所有具有特定名称的文件中的 CHMOD?

Bash SSH change CHMOD in all files with a specific name?

我有多个 Joomla!网站。如何使用 bash SSH 搜索和更改所有 "configuration.php" 文件中的 CHMOD 到 444?

使用这个:

find /path -type f -name configuration.php -exec chmod 444 {} \;

也可以通过多个路径查找:find /path1 /path2 ...

大致情况:

SERVERS="server1.example.com server2.example.com server3.example.com"

COMMAND_TO_RUN="find . -name configuration.php | xargs chmod 700"

for SERVER in "$SERVERS"
do
    ssh SERVER <<EOF
    "$COMMNAD_TO_RUN"
    EOF
done

你可以试试:

find / -name "configuration.php" -exec chmod 444 {} \;

(我还没有测试语法。)