Monday, 5 August 2019

Linoux :: How to Setup ssh passwordless login using SSH keygen between two servers

We need to connect system for monitoring,administration.We need to have ssh passwordless login setup to remote server for monitoring and administration.

In this article ,I will post steps on

How to Setup ssh passwordless login using SSH keygen between two servers

System 1 : serv1
System 2 : serv2
Username : orac
Lets us first describe from system 1 to system 2.So source server is serv1 and destination server is serv2
Step 1:
serv1_orac$ mkdir ~/.ssh
serv2_orac$ mkdir ~/.ssh
Step 2:
serv1_orac$ cd ~/.ssh
Step 3:
serv1_orac$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (“your_local_home”/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
17:6a:e3:78:ab22d:0c:8e:f9:67:f1:30:32:64:89:34 orac@serv1
Step 4:
serv1_orac$ scp ~/.ssh/id_rsa.pub orac@serv2:/home/orac/.ssh/authorized_keys
password#
Step 5:
serv2_orac$ chmod 700 .ssh
serv2_orac$ chmod 644 .ssh/authorized_keys
Ensure your /home/orac directory has the permission 755 also!
Similar steps will be use to enable password less ssh between from system 2 to system 1
Step 1:
serv2_orac$ cd ~/.ssh
Step 2:
serv2_orac$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (“your_local_home”/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
17:6a:e3:78:ab22d:0c:8e:f9:67:f1:30:32:64:89:34 orac@serv2
Step 3:
serv2_orac$ scp ~/.ssh/id_rsa.pub orac@serv1:/home/orac/.ssh/authorized_keys
password#
Step 4:
serv1_orac$ chmod 700 .ssh
serv1_orac$ chmod 644 .ssh/authorized_keys
Ensure your /home/orac directory has the permission 755 also!

Verify your work of ssh passwordless login setup

serv1_orac$ ssh serv2 date
Wed Jun 19 00:42:27 2015
serv2_orac$ ssh serv1 date
Wed Jun 19 00:42:27 2015

0 comments:

Post a Comment