amuck-landowner

Can I copy SSH keys from one server to another?

GaleDribble

New Member
Needing to upgrade a VPS of mine, so ordered a one of the Black Friday specials I saw. I know this is probably a dumb question but I've never had to do it before, but if I copy over my ~/.ssh folder from the old Debian install to the new Debian install, will it work as intended? Or do I need to re-create all new keys from the new VPS to connect to the several other VPS servers that it does now?
 

GaleDribble

New Member
I know how to move them, just wasn't for sure if they'd work as intended. It turns out that they do. Just moved ~/.ssh from one server to the next one. Logged into the new server to SSH into a different machine and the key worked as I hoped it would. I was worried I would have to recreate and recopy all my keys.
 

MartinD

Retired Staff
Verified Provider
Retired Staff
I know how to move them, just wasn't for sure if they'd work as intended. It turns out that they do. Just moved ~/.ssh from one server to the next one. Logged into the new server to SSH into a different machine and the key worked as I hoped it would. I was worried I would have to recreate and recopy all my keys.
Keys are independent - you can move them anywhere and still use them in standard configurations :)
 

samK

New Member
Copy the key to a server
Once an SSH key has been created, the ssh-copy-id command can be used to install it as an authorized key on the server. ... The copying may ask for a password or other authentication for the server. Only the public key is copied to the server.
 
Top
amuck-landowner