LoginSignup
14
14

More than 5 years have passed since last update.

多段SSHの方法

Last updated at Posted at 2015-01-03

よく忘れるのでメモ
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 <踏み台サーバ>

14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14