SSH Auto Login – MacOS X
- Create your set of keys:
Start up the Terminal application and run:
ssh-keygen -t rsa
ssh-keygen will the ask where to store the public key it is about to create. Normally the default suggestion works just fine (~/.ssh/id_rsa.pub). ssh-keygen then ask you to enter a pass phrase. Please use something secure here and please also remember it. - Copy the public key to your SSH server
Copy the newly created public key to the SSH server(s) you need to auto login into by using your favourite transport method. Please be careful not to overwrite ~/.ssh/authorized_keys if it already exist! This is how I personally copy the key, might not be your preferred method:- If authorized_keys exist:
cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat - >> ~/.ssh/authorized_keys"
- If authorized_keys does not exist:
scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys
- If authorized_keys exist:
- Optional step: You might consider restricting file access to the file authorized_keys on the SSH server.
chmod 0600 ~/.ssh/authorized_keys
to even further improve your system security.