The basis of using ssh without typing your password is public key based authentication. You need to generate a pair of public/private keys for this.
Firstly, generate your public/private keys using ssh-keygen
1
| |
You must use the -t option to specify that you are producing keys for SSH using RSA. This will generate your id_rsa and id_rsa.pub in the .ssh directory in your home directory.
- Copy ~/.ssh/id_rsa.pub to the server.
1
| |
- On the server run the following commands:
1 2 | |
Thats it! Easy as 1,2,3.
Now you should be able connect to the server via ssh without being challenged for a password.
If for some reason, it is not working for you, you may also need to do one of the following things to get it working:
- Put the public key in .ssh/authorized_keys2
- Change the permissions of .ssh to 700
- Change the permissions of .ssh/authorized_keys2 to 640