Password-less SSH access
This is mainly a note to myself because I keep forgetting these two very simple steps, it is only two commands and then you are good to go.
Well as the headline says we are going to create an SSH connection without having to enter a password everytime.
The information below is the example we are going to use in thus How To.
The first thing we are going to do is to generate a set of SSH keys with the following command.
You are going to be prompted to choose where they key should be stored but just hit enter to choose the default location.
Next you will be prompted to enter a password for the new SSH key but just leave it blank and press enter again.
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/techknight/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/techknight/.ssh/id_rsa.
Your public key has been saved in /home/techknight/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
|.=O= .. |
|+Ooo+ .. |
|*.B=.o o |
|+..+= =o o |
|E o B oS |
| ooo..o. |
| . +ooo . |
| . o+ o |
| .+ |
The next thing is to copy our newly created SSH key to the host, which is the machine we want to create a password-less SSH connection to. (don’t forget to change the username and host domain or IP here.)
This is the only time you will be prompted to enter the password for the host.
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'email@example.com'"
and check to make sure that only the key(s) you wanted were added.
And that’s it. try to login to the host machine to test if it works or not