[Discuss] SSH port forwarding through middleman (bastion host)

Kent Borg kentborg at borg.org
Fri Jun 17 18:11:49 EDT 2016


Oh, ssh has so many features, that can be obscure.

If I understand, I think this will help.

Say you:

   ssh -L 3456:foo.com:22 bar.com

Type in the password (or supply a key) for bar.com. You will get a 
prompt from bar.com

Then:

  ssh -p 3456 localhost

Type in the password (or supply a key) for foo.com. You will get a 
prompt from foo.com.

To keep your fingerprints straight might want instead to do:

   ssh -X -o UserKnownHostsFile=/home/kentborg/.ssh/known_foo -p 3456 
localhost


And you can do this with other port, put in more than one -L thingie, to 
forward more ports. Recently I needed to get to a wifi box in my 
mother-in-law's house so I did and ssh with something like "-L 
8888:10.0.0.32:80", and then I could point my browser at localhost:8888 
and hit that box.


-kb, the Kent who loves ssh, but who also persists in using (good, not 
recycled) passwords.



More information about the Discuss mailing list