Thursday 5 February 2015

LINUX : Passwordless SSH login


Make sure ssh rpms are installed in both the servers using "rpm -qa|grep openssh"

openssh-5.3p1-94.el6.x86_64
openssh-clients-5.3p1-94.el6.x86_64
openssh-server-5.3p1-94.el6.x86_64
openssh-askpass-5.3p1-94.el6.x86_64

Once thees four rmps are installed follow below steps to implement ssh

Enabling password less login from SERVER-1 server to SERVER-2 server

Step 1: Generate ssh-keygen key from SERVER-1

[oraprod@server-1 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
c2:78:81:a6:ec:9b:05:e8:a2:a9:bd:0c:14:0b:48:b0 oraprod@server-1.local.com
The key's randomart image is:
+--[ RSA 2048]----+
|o.               |
|o.   .           |
|E.  o .          |
|.ooo o .         |
|.o+ . + S        |
|o. . . .         |
|o.. .            |
|o= +             |
|= *.             |
+-----------------+

Step 2: Copy the rsa key generated in SERVER-1 server to SERVER-2 server using below and enter the password for one last time

[oraprod@server-1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub oraprod@server-2
oraprod@server-2's password:
Now try logging into the machine, with "ssh 'oraprod@server-2'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.


Step 3: Now login to the SERVER-2 server from SERVER-1 server without password

[oraprod@server-1 ~]$ ssh oraprod@server-2
Last login: Thu Feb  5 10:30:40 2015 from 10.101.50.21
[oraprod@server-2 ~]$

No comments:

Post a Comment

SQL Developer displaying Junk characters (??????)

Change the Encoding in SQL Developer Preferences as below Tools --> Preferences --> Environment --> Encoding --> UTF...