2017-10-12 141 views
0

我正在使用-oBatchMode = yes来取消交互式密码,以防密钥配置错误。ssh与-oBatchMode = yes失败;没有成功 - 没有请求密码

我已经使用'diff'来比较调试输出,直到'服务器接受密钥:pkalg ssh-rsa blen 279',其中下一行是'验证成功'或尝试更多私人密钥。

从脚本和命令行,在成功登录不批模式运行结果:

$ ssh -v [email protected] uptime 
. 
. 
Warning: Permanently added '192.168.19.81' (ECDSA) to the list of known hosts. 
debug1: rekey after 134217728 blocks 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: rekey after 134217728 blocks 
debug1: SSH2_MSG_EXT_INFO received 
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /Users/tim/.ssh/id_rsa 
debug1: Server accepts key: pkalg ssh-rsa blen 279 
--- things change from here 
debug1: Authentication succeeded (publickey). 
Authenticated to 192.168.19.81 ([192.168.19.81]:22). 
debug1: channel 0: new [client-session] 
debug1: Requesting [email protected] 
debug1: Entering interactive session. 
debug1: pledge: network 
debug1: client_input_global_request: rtype [email protected] want_reply 0 
debug1: Requesting authentication agent forwarding. 
debug1: Sending command: uptime 
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0 
13:24 up 3 days, 3:04, 2 users, load averages: 1.76 1.62 1.61 
debug1: channel 0: free: client-session, nchannels 1 
Transferred: sent 2768, received 3080 bytes, in 0.0 seconds 
Bytes per second: sent 129171.8, received 143731.6 
debug1: Exit status 0 

但同样的失败,-oBatchMode = YES:

$ ssh -v -oBatchMode=yes [email protected] uptime 
OpenSSH_7.4p1, LibreSSL 2.5.0 
. 
. 
debug1: Offering RSA public key: /Users/tim/.ssh/id_rsa 
debug1: Server accepts key: pkalg ssh-rsa blen 279 
--- things change from here 
debug1: Trying private key: /Users/tim/.ssh/id_dsa 
debug1: Trying private key: /Users/tim/.ssh/id_ecdsa 
debug1: Trying private key: /Users/tim/.ssh/id_ed25519 
debug1: No more authentication methods to try. 
Permission denied (publickey,password,keyboard-interactive). 
$ 

远程机: 达尔文qa-ffc-mbp-2.lnd 16.7.0达尔文内核版本16.7.0:Thu Jun 15 17:36:27 PDT 2017;根:XNU-3789.70.16〜2/RELEASE_X86_64 x86_64的

我的机器: 达尔文廷布斯-的MacBook-PRO-3483.local 16.6.0 Darwin内核版本16.6.0:周五4月14日16点21分16秒PDT 2017年;根:XNU-3789.60.24〜6/RELEASE_X86_64 x86_64的


更新:我复制从没有这个问题的帐户id_rsa和id_rsa.pub,并开始工作。但是我的id_rsa.pub在目标机器的authorized_keys中正确列出。我甚至从私人公钥中重新生成了公钥,以防它被破坏。没有骰子。出于显而易见的原因,我不愿意改变我的钥匙。

回答

0

看来苹果的整合钥匙扣由BatchMode=yes

如果我eval $(ssh-agent)ssh-add我的身份,一切正常禁用。

其他帐户的关键工作原因是因为它有一个空的密码。

0

您可以尝试添加这些行到你的〜/ .ssh/config文件:

Host * 
UseKeychain yes 
AddKeysToAgent yes 
+0

感谢这个 - 我工作围绕这一问题通过其他手段。如果问题再次发生,我会尝试它! –

相关问题