初めに
自分の備忘録として、パスワード認証で踏み台サーバーを経由したSSH接続に少し困ったので書いておきます。
自分がはまった部分
以下のようなconfigを書いてSSHコマンドを叩いた所、ssh: Could not resolve hostname ssh: でエラーになりました。
.ssh/config
# 踏み台サーバー
Host step-server
HostName hoge
User hoge
Port hoge
IdentitiesOnly no
TCPKeepAlive yes
# SSHしたいサーバー
Host target-server
HostName hoge
User hoge
IdentitiesOnly no
TCPKeepAlive yes
ProxyCommand ssh -W %h:%p step-server
解決策
OepnSSH 8.0よりも前のversionを使用している場合にconfigに絶対パスを使用しなければいけないらしい。
(この問題はOpenSSHのバグで、OpenSSH 8.0以降では修正されているようです)
具体的に以下のようにconfigを書いたら動きました。
.ssh/config
# 踏み台サーバー
Host step-server
HostName hoge
User hoge
Port hoge
IdentitiesOnly no
TCPKeepAlive yes
# 目的のサーバー
Host target-server
HostName hoge
User hoge
IdentitiesOnly no
TCPKeepAlive yes
ProxyCommand C:\Windows\System32\OpenSSh\ssh.exe -W %h:%p step-server # 絶対パスに変更
参考文献
以下の記事に助けてもらいました。
https://www.suzu6.net/posts/205-ssh-config-proxycommand-windows10/
何か修正した方が良いこと等、なんでもコメント頂けると幸いです。