I need to connect to server using SSH, and the server has two-factor authentication enabled and secretkey disabled. Now, I can connect "manually" form the shell with the help of Google authenticator app.

Problem is that many of the tools that I regularly use don't support 2FA (i.e. they never ask me for the additional key but simply fail to connect).

Can I somehow make a connection to the server and then "forward" it to a port locally?

I'm connecting from a mac, and I don't have root access on the remote server.


You can set up a persistent connection using the initial login, and then instruct ssh to reuse it for all subsequent connections. It's called "ControlMaster" -- there's multiple resources online on how to set it up, e.g. see this PuppetLabs article.

  • This really works! :) And for SFTP too. – frnhr Sep 16 '14 at 10:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.