Monday, March 3rd, 2008
Instant or Passwordless SSH-ing in Linux
Well, to be “correct” the title of this should have been “how to add your key to the list of authorized public keys on a remote or local linux machine”, but being a newbie like myself, I would not have known to search for it. If I wanted to find out about logging in automatically to a remote machine using a generated public key, I myself would have used “Passwordless SSH” - so there you go.
To get started, I’ll assume that you have OpenSSH set up (it’s setup by default… well usually) and that your remote machine has OpenSSH-server set up.
If not, then do the following on the remote machine:
The guide
This is just a quick guide because there really isn’t anything to it.
Step 1: Create your public OpenSSH key with:
Step 2: Transfer the generated key to the machine you want Passwordless SSH access to with scp (in this example your home directory on the remote machine)
Step 3: Connect through SSH to the remote machine and enter your password.
Step 4: Append the key you have just transfered to the authorized public keys called “authorized_keys” file in the hidden ssh directory for the account you want access to.
Step 5: Remove the source public key from the remote machine. So people don’t stumble upon your public key.
And that’s it. Your public SSH key is stored in the authorized_keys file so the next time you log in
It will not ask you for a password but automatically log you in.