, ,

Linux – multi-hop ssh via jump server

this is how to multi-hop servers in one command

ssh -A -t @  ssh -A -X 

# example to go directly to far-away-server via jump.server:
ssh -A -t jump-user@jump.server.net  ssh -A -X far-user@far-away-server.net

Using a bash alias

a@a:~$ head -1 ~/.bash_aliases
alias go='ssh -A -t base@main.app.farm.net ssh -A -X'

a@a:~$ go farm3
Last login: Thu Aug 14 14:21:09 CEST 2014 from main.app.farm3.net on pts/22
base@farm3 ~ $

References

1. http://superuser.com/questions/688011/ssh-multi-hop-adapting-command-to-ssh-config-file