よく忘れるのでメモ
Amazon VPCなどを使っているときにPrivateIPしか割り当てられていないサーバにログインする方法。
鍵はローカルに持ちたいので多段SSHする。
自分のローカルマシンの.ssh/configに記載する。
Host <踏み台サーバ>
HostName <public IPアドレス>
User ec2-user
UserKnownHostsFile /dev/null
StrictHostKeyChecking=no
PasswordAuthentication no
IdentityFile <鍵のパス>
IdentitiesOnly yes
LogLevel FATAL
PermitLocalCommand yes
Host <Privateのサーバ>
HostName <Private IP>
User ec2-user
IdentityFile <鍵のパス>
ProxyCommand ssh -W %h:%p <踏み台サーバ>