Hardware failures aren't uncommon. Your system will crash.
According to Murphy's law (If something can go wrong, it'll go wrong :P )
Whenever you generate a key pair, you end up changing your public key everywhere you've added it. If your key is on github, bitbucket, a couple of servers, it's okay. But imagine if your key is on 10000 servers, and you don't even know all the servers that it's on.
Save the files
.ssh/id_rsa and .ssh/id_rsa.pub somewhere on cloud (email yourself with appropriate subject, add them on google drive, dropbox sync, your master pen drive, etc.)
Preferably don't copy paste the content. Upload the files.
When you need to add them on new system, download the files. Let's assume they're in ~/Downloads/ssh folder.
mkdir .ssh cp ~/Downloads/ssh/id_rsa id_rsa cp ~/Downloads/ssh/id_rsa.pub id_rsa.pub chmod 700 .ssh chmod 600 .ssh/id_rsa
Now, ssh into any machines as you earlier used to. It should work out of the box.
To avoid adding your username each time you login, use something like this.
cat ~/.ssh/config HOST * USER <username_here>
This will help you type ssh < ip_address > instead of ssh < username >@< ip_address >
Also, you can specify usernames for different sets of servers.
For more info on tip: Click here.
Subscribe to acsrujan
Get the latest posts delivered right to your inbox