15
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ProxyCommandでsshの多段接続をする

Posted at

日々の業務でsshの接続先から更にsftpを叩いてローカルまでファイルを取ってくるという作業がめんどくさかったので
ProxyCommandを使って多段接続することにしました。

~/.ssh/config
Host server1
  HostName 111.222.333.444
  User tom
  Port 11111

Host server2
  HostName 555.666.777.888
  User bob
  Port 22222
  ProxyCommand ssh -W %h:%p server1

~/.ssh/config に上記のように記述します。

sshでserver2に接続すると、server1を踏み台にしてserver2にローカルから接続できます。

$ ssh server2
15
19
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
15
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?