Tuesday, September 30, 2008

Setting up ssh keys

At the command line on your local computer
1. ssh-keygen -t rsa
2. Enter a passphrase
3. scp ~/.ssh/id_rsa.pub user@remotehost.com:~/.ssh/id_rsa_temp.pub
(will need to enter your password for user@remotehost here)
Then
4. ssh user@remotehost
5. chmod ~/.ssh 700
6. cat ~/.ssh/id_rsa_temp.pub >> ~/.ssh/authorized-keys
7. rm ~/.ssh/id_rsa_temp.pub
8. chmod 600 ~/.ssh/authorized_keys (not strictly necessary)
9. log out of your shell
10. log back in
11. ssh user@remotehost.com (should now be prompted for key passphrase)

To set it up so you can log in with no passphrase:
1. ssh-agent bash
2. ssh-add (then enter key passphrase)
3. ssh user@remotehost.com

No comments: