top of page

SSH Directly to a Machine You'd Normally Need to SSH Into a Server to Get To

This post lists the steps needed to connect to an ssh server beyond an ssh server you have to connect to, to to get to it from a Linux host using OpenSSH.

Note is the server you ssh into to ssh into the other server is the server you ssh into from

Replace these names with the names you use when you apply these steps.


1. ssh into from your machine

2. Edit ~/.ssh/authorized_keys and add the public part of ~/.ssh/keys/key1/openssh.keyforremote.priv

3. ssh into from

4. Edit ~/.ssh/authorized_keys and add the public part of ~/.ssh/keys/key1/openssh.keyforsshbeyondremote.priv

5. Log out of

6. Check that AllowTcpForwarding yes in /etc/ssh/sshd_config on

Note, you may have the following:

Big, big warning: you have to ensure that you use the same case in /etc/ssh/sshd_config and in ~/.ssh/config if you use PermitOpen. This seems like a bug because DNS names are case insensitive. If you don't do this you may see:

7. From your machine add the following to ~/.ssh/config

8. Now you should be able to run this from your machine:



Version of the OpenSSH client:

Version of the OpenSSH server:


bottom of page