Is there a way in a single SSH command to login via SSH to a remote server passing through an intermediate server? In essence, I need to create a tunnel to my "bridge server" and via the tunnel to login to the remote server.
For example, I'm trying to compress the following into a single ssh command:
- ssh -N -L 2222:remoteserver.com:22 email@example.com
- ssh -p 2222 remote_userid@localhost
This currently works, but I would rather be able to squeeze everything into a single command such that if I exit my ssh shell, my tunnel closes at the same time.
I have tried the following in my config but to no avail:
Host axp User remote_userid HostName remoteserver.com IdentityFile ~/.ssh/id_rsa.eric ProxyCommand ssh -W %h:%p firstname.lastname@example.org
As per @jasonwryan comments and the transparent-mulithop link, I'm able to get the following command working:
ssh -A -t email@example.com ssh -A firstname.lastname@example.org
but now I would like to package that up neatly into my .ssh/config file, and not quite sure what I need to use as my ProxyCommand. I've seen a couple of links online as well as @boomshadow's answer that requires
nc, but unfortunately the AIX server I'm using as my bridge machine does not have netcat installed on it.