Create and add ssh keys on new Linux install
2025-05-20
Description: This is a quick how-to for creating and adding ssh keys on a new Linux install.
When and why: I do this when I get a new Linux install, and I want to be able to ssh into my other machines without having to enter a password each time.
This is pretty simple stuff, but I do this less than once a year, so I still need a quick how-to so I don't have to "google" it each time (I don't actually use google).
SSH Key-Based Authentication on a Linux Server
- Create the keys.
ssh-keygen -t rsa
- Copy the new SSH Public Key to the remote server.
Find and copy the public key:
cat ~/.ssh/id_rsa.pub
On the remote server:
nano ~/.ssh/authorized_keys
Paste the public key into the editor. Save. Done.
- Test that it works from a new terminal window, without logging out of the old one first. You never know.