I have the following setup, where I am trying to connect from "Host A" through "Bastion" to "Host B". Simple you might think and something which has been done hundreds of times before, but I am trying to do something slightly different.

Host A (Windows) -- PuTTY/SSH --> Bastion (Linux) -- SSH --------> Host B (Linux - 2FA)
                                                     ControlMaster auto
                                                     ControlPersist yes

As "Host B" is using 2 Factor Authentication, I am using ControlPersist on the "Bastion" so I only need to authenticate once - subsequent connections from "Bastion" to "Host B" will be multiplexed in the original connection and bypass authentication. Public Key authentication has been disabled on "Host B" before anyone suggests that.

"Host A" uses Public Key authentication to "Bastion" and I am trying to set it up so "Host A" can take advantage of the existing persistent connection on the "Bastion". I can get this working by configuring "Host A" to connect to "Bastion" and use a remote command of "ssh HostB", which then runs SSH on the "Bastion" and uses the existing connection.

However, if I want to SCP a file from "Host A" to "Host B" then it doesn't work using this method.

The other approach is to use the equivalent of ProxyCommand on "Host A" to use "Bastion" as a proxy, but this effectively sets up an SSH tunnel from "Host A" to "Host B" via "Bastion" so it doesn't take advantage of my existing persistent connection. I can of course enable ControlPersist on "Host A", but PuTTY isn't as good as Linux and I can't do the equivalent of "ControlPersist yes" and keep it wihtin the background.

I am pretty sure you can do anything using SSH, but I am looking for some wisdom on this one so SCP works?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.