I'm currently using a Windows PC to connect to a headless mini PC running Ubuntu Server via SSH with a key pair I created using OpenSSH. I'm planning to sell my Windows PC soon and replace it with a MacBook. What's the best way to reconfigure my SSH connection? Can I just transfer my existing private key to the Mac, and is that advisable?
5 Answers
It's usually best practice to generate your SSH key directly on the machine you're using rather than copying it from another device. But if you want to move your existing key, you can copy the entire .ssh directory from your Windows PC to your Mac. Just be sure to remove your SSH key from the Windows machine securely before selling it—like completely wiping that drive!
Yes, you can transfer your private key from Windows to your MacBook. Just copy the key over to your ~/.ssh directory on your Mac, but double-check that you're not overwriting anything important. Also, be sure to wipe your Windows machine to keep your keys secure.
From what I've experienced, just copying the private key should work fine, especially if it's in the right format for SSH keys. Just remember, if it came from a different system like PuTTY, you might need to extract or convert it first. And it's also a good idea to create a new key for your Mac if you want added security.
By the way, what do you use your headless server for? I'm just curious!
Honestly, the safest way is to make a new key pair on your MacBook. You can generate it with ssh-keygen, then use ssh-copy-id to copy the public key to your Ubuntu server, which helps maintain security. Plus, then you won't have to worry about old keys hanging around.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux