今天读了一下ssh的man手册,期望发现可以jump多主机跳转到目标机器的方法,果然找到了,记录如下:
ssh -J "user@host1:port,user@host2:port,user@host3:port" user@host4
#mam手册的解释:
-J [user@]host[:port]
Connect to the target host by first making a ssh connection to the jump host and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be
specified separated by comma characters. This is a shortcut to specify a ProxyJump configuration directive.
多主机之间用逗号隔开,如果某个主机的sshd服务不是默认22端口,需要在IP后加“:port”(冒号和端口号)指定主机端口