SSH / SCP Proxy Jump

Kevin FOO
2 min readApr 11, 2022

Before the pandemic, connecting to an Ubuntu instance with SSH in North Virginia was fast from Singapore. During the pandemic when everyone was working from home, the connection to North Virginia was terrible. Typing on the SSH terminal has a lag, where I already completed typing a word then a second or two later it appears on the terminal window.

To workaround this lag, I had to launch an extra Ubuntu instance in Singapore to use it as a jump host to reach my North Virginia instance. Assuming the IP and ID are these

# Singapore instance
# IP = 1.2.3.4
# ID = sg-user
# North Virginia instance
# IP = 6.7.8.9
# ID = us-user
# File path = ~/readme.txt

The command to jump host will be

ssh -J sg-user@1.2.3.4 us-user@6.7.8.9# equivalent command
ssh -oProxyJump=sg-user@1.2.3.4 us-user@6.7.8.9

Downloading some file through SCP command will be

scp -J sg-user@1.2.3.4 us-user@6.7.8.9:~/readme.txt .

The jump host is not limited to one. It can be jumped through multiple hosts separated by comma. Assuming the IP and ID are these

# Singapore instance
# IP = 1.2.3.4
# ID = sg-user
# London instance
# IP = 2.3.4.5
# ID = uk-user
# North Virginia instance
# IP = 6.7.8.9
# ID = us-user
# File path = ~/readme.txt

The multiple host jump command will be

ssh -J sg-user@1.2.3.4,uk-user@2.3.4.5 us-user@6.7.8.9# equivalent command
ssh -oProxyJump=sg-user@1.2.3.4,uk-user@2.3.4.5 us-user@6.7.8.9

The equivalent SCP command will be

scp -J sg-user@1.2.3.4,uk-user@2.3.4.5 us-user@6.7.8.9:~/readme.txt .

< Back to all the stories I had written

--

--

Kevin FOO

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.