2017-04-11 5 views
0

私はパスフレーズを使用しないSSH鍵を持っています。 Dockerコンテナを構築するときに、そのキーを使用してプライベートgitリポジトリを取得したいとします。SSHでパスフレーズレス鍵のパスフレーズが必要なのはなぜですか?

ビルド時にコンテナにキーを取得することに成功しましたが、今度は/ dev/ttyを開いてキーのパスフレーズを尋ねることができないため、SSHが失敗します。上記のように、キーにはキーがありません。ここで

はあなたのキーファイルが何らかの方法で破損している可能性があり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. 
+0

注:SSH(一部のバージョン少なくとも)パスフレーズを、それがキーファイルの意味を理解することはできません任意の時間を促すメッセージが表示されますこのスレッド](http://stackoverflow.com/a/18079668/1979736) – K40S

答えて

1

です。私はすでに提案された方法[内を使用して `は/ dev/tty`を追加しようとした

$ 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 [email protected] 
Enter passphrase for key 'key': 
+0

これはおそらく問題です。ヒントをありがとう。 :) – K40S

+0

これは本当に問題でした。キーファイルの改行がありませんでした。私は別の方法で画像にキーを取得することでそれを修正しました。 – K40S

関連する問題