30 April 2013
Category:
Linux
Security
Comments: Comments Off on Adding SSH Keys for password less login

Adding SSH Keys for password less login

Password less SSH login can be very useful when setting up automated backup via SSH or similar tasks.  First of all generate the RSA ssh key on the server using below commands. Leave the passphrase empty. It will generate the SSH public key in file /root/.ssh/id_rsa.pub

root@admin [~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e0:39:f9:6f:07:3b:a6:06:80:39:b0:30:3e:ec:98:d7 root@admin.servertechsupport.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|+                |
|++ o  .          |
|.++ .. +         |
|o..o .= S        |
|o.. E .o  .      |
| .     ..  o     |
|        ..= .    |
|       ..+.o     |
+-----------------+
root@admin [~]#

Now copy the RSA public key to remote server using ssh-copy-id script

ssh-copy-id -i /root/.ssh/id_rsa.pub "root@REMOTE_SERVER_IP -p 2233"

Here 2233 is remote SSH port.

Comments are closed.