1
3

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.

scp: リモートからリモート、多段ssh

Posted at

多段sshを使ってやりたい

.ssh/configに以下を記載する

.ssh/config
# 経由するサーバー
Host tunnel
   HostName ***.***.***.***
   User user
   IdentityFile ~/key.pem # tunnel用の秘密鍵

# ファイルコピー元サーバー
Host from_host
   HostName ***.***.***.*** # tunnelからfrom_hostに接続するためのIP
   User user
   IdentityFile ~/key_from.pem # from_host用の秘密鍵
   ProxyCommand ssh -W %h:%p tunnel

# ファイルコピー先サーバー
Host to_host
   HostName ***.***.***.*** # tunnelからto_hostに接続するためのIP
   User user
   IdentityFile ~/key_to.pem # to_host用の秘密鍵
   ProxyCommand ssh -W %h:%p tunnel

リモートからリモート

-3を付けることでリモートからリモートが可能になる

$ scp -3 from_host:filepath to_host:file_path
1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?