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

March 26, 2018


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:


Please reload

Our Recent Posts

DOE PAMS Specialties

September 5, 2020

Good Link for HOWTO Bring an Off-Screen Window Back Onto Screen for Windows 10, 8, 7, and Vista

September 5, 2020

Connect to and Control a Synaccess NPC-22 netCommander from Ubuntu 16.04.3 Running in a VirtualBox VM via a Prolific Technology Inc. USB to Serial Port Converter to Turn a Target On and Off

September 4, 2020

Please reload


Please reload


©2020 by Zach Pfeffer