If your remote username is different from your OS X username, edit your ~/.ssh/config
file like so:
Host whathaveyou.com
User remote_username
On your OS X machine, enter this command:
ssh-keygen
Enter a password or don't (I didn't).
This creates a public (~/.ssh/id_rsa.pub
) and private key (~/.ssh/id_rsa
).
Log in to the server with ssh (with your password--for the last time).
However you want to do it, open the file ~/.ssh/authorized_keys
on the remote server and paste in the contents of id_rsa.pub
. Alternately, you could use scp
like so:
scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys
(Naturally, if the file and/or folder aren't there, you'll have to create them first.)
Now change the permissions:
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys
All done. The next time you want to ssh to the server, it won't prompt you for a password.
- Correspondence with Jason and Scott.
- Geek Times
- Rails Machine
former location
This is a Solutions Log post.