在使用parallel-ssh(和相关工具)执行任务时,我想使用受密码保护的 SSH 密钥。但是,我无法让它发挥作用。
所有关于 的文档都parallel-ssh表明我应该能够使用--askpass或-A做到这一点:
-A
--askpass
Prompt for a password and pass it to ssh. The password may be
used for either to unlock a key or for password authentication. The
password is transferred in a fairly secure manner (e.g., it will not
show up in argument lists). However, be aware that a root user on
your system could potentially intercept the password.
Run Code Online (Sandbox Code Playgroud)
但是,当我输入密钥的密码时,它不起作用:
$ parallel-ssh --hosts=machines --user=my_user --askpass \
--timeout=0 …Run Code Online (Sandbox Code Playgroud) Linux:ubuntu 14.04.3 LTS
cat /tmp/passfile
ABCxyz123
Run Code Online (Sandbox Code Playgroud)
sshpass -f /tmp/passfile parallel-ssh -I -A -h hostlist.txt "sudo -S ls -l /root" < /tmp/passfile
并且该方法在谷歌讨论此处描述groups.google 输出误差为:
[1] 01:07:25 [FAILURE] 10.0.4.194 Exited with error code 255
[2] 01:07:25 [FAILURE] 10.0.4.205 Exited with error code 255
Run Code Online (Sandbox Code Playgroud)
在远程服务器中,我试图连接它的 /var/log/auth.log 有以下消息
Sep 24 19:20:52 ubu1401 sshd[5765]: Accepted password for ubuntu from 10.0.4.1 port 55019 ssh2
Sep 24 19:20:52 ubu1401 sshd[5765]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Sep 24 19:21:26 ubu1401 sshd[5765]: pam_unix(sshd:session): session closed …Run Code Online (Sandbox Code Playgroud)