//TODO: professional stuff of software engineerĀ 1001010
Note to self: ssh auto login

Sometimes I want ssh to just connect and not ask me for the remote password. By sometimes, I mean last time was 2 years ago.

This works on my mac, your mileage will vary

Make some keys

me@local ~> ssh-keygen -t rsa
Enter file in which to save the key (~/.ssh/id_rsa): ~/.ssh/id_rsa_EXAMPLE
passphrase: REDACTED
passphrase again: REDACTED
bla bla bla info about the fingerprint & ascii art

Ensure there is a ssh folder on remote

Note: you may have to change permissions on the remote .ssh folder and .ssh/authorized_keys

me@local ~> ssh NAME@EXAMPLE.COM mkdir -p .ssh

Send our newly minted public key to the remote

me@local ~> cat ~/.ssh/id_rsa_EXAMPLE.pub | ssh NAME@EXAMPLE.COM 'cat >> .ssh/authorized_keys'

Tell OSX to use our key

me@local ~> ssh-add ~/.ssh/id_rsa_EXAMPLE

Test it out by connecting to it

me@local ~> ssh NAME@EXAMPLE.COM
Welcome to EXAMPLE.COM
Last Login: TIMESTAMP from YOURIP
NAME@EXAMPLE.COM ~> _

About

Categories: Linux, NoteToSelf