You can try using an agent that remembers your credentials, such as Pageant, which is usually installed alongside WinSCP. Depending on the specific 2FA implementation and what the 2FA is actually protecting, that may or may not fix the issue.
If that doesn't work--which, it probably won't--you're stuck limiting WinSCP to a single connection. Unfortunately, that's going to limit the functionality of WinSCP somewhat: background transfers will no longer work. This has a few effects:
- You won't be able to browse the filesystem while any upload/download operation is in progress.
- SSH operations, such as the shortcuts to create tarballs, will still require a separate connection, meaning you have to authenticate again.
- You'll only be able to transfer one file at a time.
- You'll only be able to queue one object at a time (file or directory)--that is to say, there is no longer a queue. Everything takes place in the foreground, and you have to wait for it to finish before proceeding.
To toggle this state, you need to completely disable background transfers. This isn't quite as straightforward as it could be; there are two places you'll need to adjust settings:
- The preferences dialog (Transfer -> Background)
- The file transfer dialog at transfer time
Additional useful info on WinSCP website: Transfer Queue
In on the Transfer -> Background preferences page, change the maximum number of simultaneous connection to 1
, disable queue processing by default, and make sure any settings related to background transfers are disabled.
At transfer time, you'll see the transfer dialog:
Make sure Transfer on background
is unchecked.
Side note: You're better off using smart cards with PGP than 2FA for top-notch SSH security. You can even get "universal" security devices like YubiKey that support more than just smart card functionality, and are generally smaller. Just make sure you generate the private key on the card itself and use multiple cards. If you have the same private key on multiple cards, though, you did something very wrong. – Zenexer – 2016-08-31T04:51:11.557