Passwordless SSH
This one's for the geeks...
I have a server inside my LAN that I ssh to a LOT. Not having to type in my password would save me quite a bit of time. There are a lot of tutorials out there but I think this one cuts straight through to the point :D
On The Server
On Your Computer
That's it! SSHing into your server, from the computer you set this up from, will no longer require that you type in your password. Instead, it will use your public key to decrypt messages sent from your computer, using your private key.
For more information on how this public/private key system works, see Wikipedia: http://en.wikipedia.org/wiki/Public_key
I have a server inside my LAN that I ssh to a LOT. Not having to type in my password would save me quite a bit of time. There are a lot of tutorials out there but I think this one cuts straight through to the point :D
On The Server
- Make sure "RSAAuthentication" and PubKeyAuthentication" are both set to "yes" in your ssh config file. (/etc/ssh/sshd_config)
- If they weren't, and you changed them, restart ssh. (/etc/init.d/ssh restart)
- Change to your home directory. (cd ~)
- Check that the '.ssh' directory exists. (ls -dl .ssh)
- Confirm it has the correct permissions. (chmod 700 .ssh)
On Your Computer
- Change to your home directory. (cd ~)
- Check that the '.ssh' directory and your public (id_rsa.pub) and private (id_rsa) keys exist. (ls -l .ssh/)
- If they don't, create them. (ssh-keygen -t rsa) Press enter in response to each question.
- Now copy them to your server. (ssh-copy-id -i .ssh/id_rsa.pub user@server:) You'll need to type in your SSH password this one last time.
That's it! SSHing into your server, from the computer you set this up from, will no longer require that you type in your password. Instead, it will use your public key to decrypt messages sent from your computer, using your private key.
For more information on how this public/private key system works, see Wikipedia: http://en.wikipedia.org/wiki/Public_key
Subscribe to Blog Posts