在 pssh 中将密码作为参数传递
pass the password as an argument in pssh
我正在尝试编写一个脚本,它将 运行 在具有 pssh
的多台计算机上发出命令。
有没有办法在同一个命令行中传递密码,如下所示:
$ pssh -h pssh-host.txt -l root -A "pswd" echo "hi"
Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
Password:
尝试了以下解决方案:
sshpass -pabc pssh -h pssh-host.txt -l root -A echo "hi"
Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
[1] 13:55:56 [SUCCESS] x
[2] 13:55:56 [SUCCESS] y
我不想要这个 Password:
提示。有人可以为此建议一种方法吗?
作为社区 Wiki 交叉发布 an answer by user568109 on Unix SE:
Found the solution on net not long after posting the question.
The solution is:
- Install and use sshpass
- Use interactive mode to force the password which is just an empty string
- Used command
cat local | sshpass -ppassword parallel-ssh -I -h new_hosts -l root -A 'cat >> remote'
Original solution at:
http://www.getreu.net/public/downloads/doc/Secure_Computer_Cluster_Administration_with_SSH/
我正在尝试编写一个脚本,它将 运行 在具有 pssh
的多台计算机上发出命令。
有没有办法在同一个命令行中传递密码,如下所示:
$ pssh -h pssh-host.txt -l root -A "pswd" echo "hi"
Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
Password:
尝试了以下解决方案:
sshpass -pabc pssh -h pssh-host.txt -l root -A echo "hi"
Warning: do not enter your password if anyone else has superuser
privileges or access to your account.
[1] 13:55:56 [SUCCESS] x
[2] 13:55:56 [SUCCESS] y
我不想要这个 Password:
提示。有人可以为此建议一种方法吗?
作为社区 Wiki 交叉发布 an answer by user568109 on Unix SE:
Found the solution on net not long after posting the question.
The solution is:
- Install and use sshpass
- Use interactive mode to force the password which is just an empty string
- Used command
cat local | sshpass -ppassword parallel-ssh -I -h new_hosts -l root -A 'cat >> remote'
Original solution at: http://www.getreu.net/public/downloads/doc/Secure_Computer_Cluster_Administration_with_SSH/