Tuesday, June 25, 2019

ssh multiple hops / SSH Config


ssh -tt user_b@HOSTB ssh user_c@HOSTC -p 4567

ssh -J user_b@HOSTB,user_c@HOSTC user_d@HOSTD



Exemplos de ~/.ssh/config

------------------------------------------------------------------------------------------------------- user_a@HOSTA -> user_b@HOSTB:22 -> user_c@HOSTC:4567

Host *
   ControlPersist 18000
   ControlMaster auto
   TCPKeepAlive yes
   ServerAliveInterval 30


Host c_jump1
  User user_c
  Hostname HOSTC
  Port 4567
  ControlPath /tmp/ssjump1
  ProxyCommand ssh -W %h:%p user_b@HOSTB

Host c_jump2
  User user_c
  Hostname HOSTC
  Port 4567
  ControlPath /tmp/ssjump2
  ProxyCommand ssh user_b@HOSTB exec nc %h %p

------------------------------------------------------------------------------
user_a@HOSTA -> user_b@HOSTB:22 -> user_c@HOSTC:4567 -> user_d@HOSTD:7890

Host c_jump3
  Hostname HOSTD
  User user_d
  Port 7890
  ControlPath /tmp/ssjump3
  ProxyJump user_b@HOSTB:22,user_c@HOSTC:4567


-----------------------------------------------------------------------------
# man 5 ssh_config

https://www.systutorials.com/docs/linux/man/5-ssh_config/
http://www.openssh.com/txt/release-5.4

No comments:

Blog Archive