我想通过SSH连接到一台机器(称之为A)。它的sshd配置文件如下所示:
AllowGroups wheel
AllowTcpForwarding no
AuthorizedKeysFile .ssh/authorized_keys
Banner /etc/issue
ChallengeResponseAuthentication no
Ciphers aes256-ctr,aes128-ctr
Compression delayed
GatewayPorts no
MACs hmac-sha1
MaxSessions 1
PasswordAuthentication yes
PermitRootLogin yes
PermitTunnel no
PermitUserEnvironment no
Protocol 2
RhostsRSAAuthentication no
StrictModes yes
Subsystem sftp /usr/lib64/ssh/sftp-server
UsePAM yes
UsePrivilegeSeparation yes
X11Forwarding no
我有另一台机器(称之为B - ssh客户端) 现在,如果我尝试ssh到machineA如下,它的工作完美:
ssh root@machineA
然后以交互方式提供密码。工作完美!
现在,我尝试使用sshpass
实用程序通过脚本传递密码,如下所示:
sshpass -p PASSWORD ssh -vvv -o=StrictHostKeyChecking=no root@machineA
这失败了。
-vvv
调试的最后几行如下:
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: packet_send2: adding 64 (len 51 padlen 13 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
机器A上的 /var/log/auth.log
如下所示:
Connection from machineB port 44408
Failed password for root from machineB port 44408 ssh2
Connection closed by machineB port 44408 [preauth]
lastb
命令在下面给出:
root ssh:notty machineB Sun Jul 3 04:20 - 04:20 (00:00)
root ssh:notty machineB Sun Jul 3 04:19 - 04:19 (00:00)
我一直在读它。但是,我不能停下来。你有什么指针吗?可能是什么问题?
与sshpass
或其他相关的任何内容?
答案 0 :(得分:0)
我会尝试缩小问题范围:
同时查看服务器日志,检查/ var / log / secure或类似内容。