Port Forward via Bastion in 1 command? - TechRepublic
Question
May 3, 2012 at 06:55 AM
cjeddie2003

Port Forward via Bastion in 1 command?

by cjeddie2003 . Updated 14 years, 1 month ago

I’m looking for a way to port forward from my local machine via a bastion host to my actual destination machine in a single command. Ideally I can’t use authorized keys and must use keyboard-interactive password authentication the entire way.

A command I tried sort of gets 50% of the way there but I’m hoping someone knows a better or improved method than below:

ssh -n -T -L [local_port]:localhost:[bastion_port] user1@bastion_host ‘ssh -o StrictHostKeyChecking=no -n -T -L [bastion_port]:localhost:[remote_port] user1@remote_host’

(the above ssh’s port forwarding to the bastion, then uses the same ssh session to launch a second ssh session to the target host. The problem is that it doesn’t prompt for the second password and just prints

“Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).”

Any ideas?

This discussion is locked

All Comments