我需要编写 shell 脚本在 centos linux 多机并行执行 c++ 程序而不询问密码,所以我可以写吗请帮助我感谢您的回复。
我试着这样写,但这不是平行的,而且要求密码
#!/bin/sh
(
ssh oracle@172.20.2.147 "/oracle/Desktop/analysis/engine"#machine1
ssh oracle@172.20.2.146 "/home/storage/Desktop/storage/storage"#machine2
ssh oracle@172.20.2.148 "/home/oracle/Desktop/agregete/collection"#machine3
)
the 3 executable files are engine,storage and collection respectively
每个顺序执行并询问密码,但我需要在不询问密码的情况下瘫痪并执行
最佳答案
如前所述,这实际上是一个关于 Super User 的问题或 Server Fault .但为了给你一个答案,我认为你的问题的解决方案应该是this .此解决方案对 ssh 的工作方式与对 scp 的工作方式相同。正如 Joachim Pileborg 已经指出的那样,更好的方法是使用公钥。
关于linux - shell脚本在不同机器上并行执行c++程序而不询问密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35363891/