This tutorial is going to show you how to login to remote SSH server without having to type password. In other word, this tutorial will show you how to configure password less login over SSH. In this example I want to login to my server with IP address 192.168.2.109 from my local Ubuntu desktop at 192.168.2.103.
On my Ubuntu desktop (localhost), I do the following on Terminal:
ssh-keygen -t rsa
dhani@dhani-ubuntu:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dhani/.ssh/id_rsa):
/home/dhani/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/dhani/.ssh/id_rsa.
Your public key has been saved in /home/dhani/.ssh/id_rsa.pub.
The key fingerprint is:
The key’s randomart image is:
+–[ RSA 2048]—-+
| . .. |
| . . o |
| . .o.. . . |
| . =+ o . |
| o… S o |
| . . + o E |
| . …+. + |
| . . ..* |
| o |
The command above will create the new public key on my localhost. This new key will be copied to the remote server using scp command below.
scp /home/dhani/.ssh/id_rsa.pub email@example.com:.ssh/authorized_keys2
Now try to login to the remote SSH using command:
dhani@dhani-ubuntu:~$ ssh firstname.lastname@example.org
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-generic-pae i686)
* Documentation: https://help.ubuntu.com/
System information as of Sat Mar 22 09:54:38 WIT 2014
System load: 0.03 Processes: 117
Usage of /: 9.8% of 18.94GB Users logged in: 1
Memory usage: 52% IP address for eth0: 192.168.2.109
Swap usage: 0%
Graph this data and manage this system at https://landscape.canonical.com/
148 packages can be updated.
68 updates are security updates.
Last login: Sat Mar 22 09:46:27 2014 from 192.168.2.109
The server did not ask me for a password. Its logged in automatically.