You are here

SSH without password

SSH keys without password

If you want to connect to hosts through ssh without typing the password everytime, follow the instructions below.

No password at all

This is the quickest way, but is not recommended if someone else can get your keys (computer thief or even administrators). They will gain access to every machine you configure.

Check if you have the keys

$ ls  ~/.ssh
You should see a private and a public key, for instance:
id_rsa    id_rsa.pub
If you don't, generate them. As you don't want to type a password everytime you use ssh, press enter when it asks for it:
$ ssh-keygen
If it fails, try adding the type option:
$ ssh-keygen -t rsa

Copy your public key to the remote machine

Adjust the public key file accordingly:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote
Next time, you should be able to ssh at remote without typing a password.

Typing the key password once

This is the most secure way. Even if your keys are stolen, they will be useless without its password. Follow these instructions in order to type the password only once per session. Notice you can also use
$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote
to copy your public key to a remote host.