当前位置:网站首页>SSH connects to the remote host through the springboard machine

SSH connects to the remote host through the springboard machine

2022-04-23 15:05:00 Shibao

There are two ways to choose , Include  ProxyJump and   ProxyCommand .

ProxyJump It is in the form of port forwarding , The springboard machine is required to support port forwarding .

ProxyCommand It's through SSH Protocol forwarding

In terms of security ,ProxyJump It's higher , Because it's end-to-end encryption , The springboard machine only does forwarding through transmission , Maybe the performance is also good .

Here are two examples , This includes transit through multiple springboards and login with certificates ,Host1 The certificate of the local user has been preset ( This is also the usual way ), By modifying the profile .ssh/config Realization :

Host Host1
  HostName 192.168.0.1
  Port 22
  User yourusername

Host Host2
  HostName 192.168.0.2
  Port 22
  User yourusername
  IdentityFile  ~/xxx.pem
  ProxyJump Host1

Host Host3
  HostName 192.168.0.3
  Port 22
  User yourusername
  IdentityFile  ~/xxx.pem
  ProxyJump Host2
  
Host Host1
  HostName 192.168.0.1
  Port 22
  User yourusername

Host Host2
  HostName 192.168.0.2
  Port 22
  User yourusername
  IdentityFile  ~/xxx.pem
  ProxyCommand ssh Host1 -W %h:%p

Host Host3
  HostName 192.168.0.3
  Port 22
  User yourusername
  IdentityFile  ~/xxx.pem
  ProxyCommand ssh Host2 -W %h:%p
  

 

版权声明
本文为[Shibao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231408547389.html