I'm trying to create a secure and private way to access my personal PC from most desktop PCs. The method I've devised so far is:

  1. Create an SSH tunnel to my PC
    • The connection is encrypted
    • The connection uses a public key exchange instead of a password
    • The connection requires the passphrase of my key and two-factor authentication via my phone
  2. Use a remote desktop to access my PC - I'm using Windows' Remote Desktop Connection since it will already be installed on most PCs
  3. I'm storing the private key for the SSH connection on a flash drive

The biggest weakness I see is that my private key is on a flash drive that I'm liable to loose. Is there a good alternative, maybe encrypting the flash drive, so that even if I loose it I'm not too exposed? The key is also encrypted via passphrase, so I think I'm alright. But the drive also has my IP. BitLocker is not an option as I don't have windows Pro or Enterprise.

Criticisms of other glaring holes in my plan are also welcome. Of course, I would also have to reasonably trust the client PC I'm using to connect to my server.

1 Answer 1


If the private key is protected with a strong(!) passphrase that cannot realistically be recovered with a brute-force attack, it's fine to store it on a USB stick. Adding another factor like time-based one-time passwords makes this a fairly solid scheme. An attacker would have to get your USB stick and your passphrase and your phone.

As a more secure alternative to general-purpose USB sticks, consider a specialized hardware token like a YubiKey. The benefit is that the private key is kept in tamper-resistant storage and never revealed to the client PC. Instead, all cryptographic operations happen directly on the device. So even if the client PC is compromised, it cannot read the key itself. If you lose the token, then there also isn't a simple way for an attacker to obtain the key.

Smartcards have the same purpose and might be a bit more convenient to carry around, since they fit into the wallet. However, then of course each client PC needs to have a card reader, ideally with a pinpad -- or you have to bring your own.

  • Most tokens and smartcards are a pain when it comes to Windows drivers, though – the only kinds I'd recommend for portable use would be PIV/CAC compatible ones, indeed specifically Yubikey in CCID mode. (Not quite recommending FIDO2 keys for SSH since I've got the impression they require a very up-to-date OS for support, while PuTTY-CAC.exe or libykcs11.dll for OpenSSH can be easily carried around on a USB stick...)
    – grawity
    Commented May 19 at 6:34
  • This answer seems to focus on an attack at rest (recovery from the USB stick) but does not emphasize enough the risk of using the USB stick from a compromised PC: if the "random" PC used by the OP is compromised, then the attacker can recover the private key after it's been decrypted using the passphrase. This is why specialized HW is so important, and so much better than a passphrase. Commented May 19 at 10:36
  • @MatthieuM.: I've pointed this out right in the second paragraph.
    – Ja1024
    Commented May 19 at 10:50
  • @Ja1024: And I'm saying that the second paragraph is not specific enough. It's not clear what "extracting" the key means, and a casual reader may think it's just the same as the attack at rest (ie, reading the encrypted key file on the USB stick and somehow figuring out the key), while the actual attack is about managing to read the already decrypted key. Commented May 19 at 11:07
  • 1
    @MatthieuM. Well, if the "random PC" is compromised, no amount of effort to protect the private key will make it safe to use. Said compromised PC can do whatever it wants to the destination computer over the SSH channel once it's established (plant malware, set up backdoors, etc.).
    – TooTea
    Commented May 19 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .