###前提・実現したいこと
サーバBへのSSHログインを行う際に、必ずサーバAを踏み台にしてログインをするようなルールの基、設定を行っています。
ログインに使う鍵は、自端末で生成した公開鍵をサーバAに登録、サーバAで生成した公開鍵をサーバBに登録という状態になっています。
なので、多段SSHログインの際、サーバAへログインするための鍵は自端末に、サーバBへログインするための鍵はサーバAにあり、それぞれ利用したいです。
~/.ssh/configへの記述方法をご教授頂ければと思います。
###発生している問題・エラーメッセージ
サーバAへのログインまでは可能ですが、サーバA→サーバBの際に、ローカルの鍵を参照してしまいログインすることが出来ません。
ssh_exchange_identification: Connection closed by remote host
###試したこと
~/.ssh/configへの記述
Host hostA HostName xxx.xxx.xxx.x1 User myuser Identityfile ~/.ssh/keyA Host hostB HostName xxx.xxx.xxx.x2 User myuser Identityfile ~/.ssh/keyB ProxyCommand ssh hostA nc %h %p
さらに追記したものの、目的とは違う結果
Host hostA HostName xxx.xxx.xxx.x1 User myuser Identityfile ~/.ssh/keyA Host hostB HostName xxx.xxx.xxx.x2 User myuser Identityfile ~/.ssh/keyB ProxyCommand ssh -o 'ForwardAgent yes' HostA 'ssh-add && nc %h %p'
###補足情報(言語/FW/ツール等のバージョンなど)
自端末:OSX 10.11.6
サーバ:Amazon Linux 2016.03.3

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/03 11:04
2016/09/03 14:54
2016/09/04 09:22
2016/09/04 12:15
2016/09/05 06:26