1. 通过-J参数指定跳板机
1
2
3
$ ssh -J user@<bastion:port> <user@remote:port>
// scp
$ scp -J user@<bastion:port> sourcefile <user@remote:port>:
  1. 在.ssh/config中配置
1
2
3
4
5
6
7
8
9
10
11
12
### The Bastion Host
Host jump
HostName 10.2.3.2
Port 3022
User jump

### The Remote Host
Host remote
HostName 172.32.2.7
Port 22
User root
ProxyJump jump

使用普通参数就可以实现跳转

1
2
$ ssh remote
$ scp <sourcefile> remote:/data/