为什么SSH需要密码才能使用无密码短语?

时间:2017-04-11 14:23:22

标签: git docker ssh

我有一个不使用密码短语的SSH密钥。我想在构建Docker容器时使用该密钥来提取私有git存储库。

我成功设法在构建时将密钥放入容器中,但现在SSH失败了,因为它无法打开/ dev / tty来询问密钥的密码。如上所述,钥匙没有钥匙。

这里有一些SSH输出(-v)

debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: No more authentication methods to try.
Permission denied (publickey).
fatal: Could not read from remote repository.

1 个答案:

答案 0 :(得分:2)

您的密钥文件可能在某种程度上已损坏。 ssh(至少某些版本)会在无法理解密钥文件时提示输入密码:

$ dd if=/dev/urandom of=key bs=1500 count=1
1+0 records in
1+0 records out
1500 bytes transferred in 0.000190 secs (7893922 bytes/sec)
$ chmod 600 key
$ ssh -i key foo@localhost
Enter passphrase for key 'key':
相关问题