Ssh keygen question

First of all, thank you for your videos. I learn a lot from it. Second, your main page doesn’t have secure certificate if you just type learnlinux.tv. I believe it should force ssl.

Now to a real question.

I understood that ssh key is best way to remote manage a server. Let’s say I have 4 homelab VM server and I am managing all from my personal PC. Can I copy public and private key and move to new PC if I reinstall OS. Because what if I disable password authentication and only way was my old pc to remote manage those 4 homelab VM or cloud VM on linode for instance.

I would appreciate your help. Thank you.

1 Like

Yes, you can copy your key (including by backup/restore) to another PC.

One gotcha with moving keys around… At least it has gotten me a bunch of times is that ssh is really picky about the permission of the .ssh directory and all of its contents. If the permissions are wrong ssh will silently refuse to connect.

Every time, I have to google for “Linux ssh file permissions” to figure out the correct permissions.

If you do

$ chmod -R go-rwx ~/.ssh

you should be fine.