How to communicate two servers using SSH | RS DIGITECH

14 May 2021

blog details

How to communicate two servers using SSH | RS DIGITECH

By: RSDigitech | Published At : 14 May 2021    


Steps to communicate two servers using SSH

To build communication between two servers using SSH, follow the four steps on both the servers to end a successful communication. 

On Server one:

Step 1: 

  • First, create a user.

image

  • Enter the password and retype it for confirmation.
  • Enter the password and retype it for confirmation
  • Enter all values and continue with yes.
  • Enter all values and continue with yes.

Step 2:

  • Make that add the user as a sudo user.
  • Make that add the user as a sudo user.
  • Add the content under user privilege specification.
  • Add the content under user privilege specification.
  • Press these keys at a time, CTRL X + Y + Enter.

Step 3: 

  • Change the sshd_config file for password Authentication.Change the sshd_config file for password Authentication.
  • Replace "YES" in the place of "NO".
  • Replace “YES”in the place of “NO”
  • Now, Save and exit it.

Step 4:

  • service ssh restart

On Server Two:

Just repeat the steps followed for server one on server two.

Server one: (172.31.10.155)

  • Switch to the user.
  • # su naresh
  • ssh <privateIP_server_two>
  • ssh <privateIP_server_two>
  • Enter the user password.
  • Enter the user password.
  • Successfully logged into Sever two (172.31.4.50) with a password.
  • Successfully logged into Sever two (172.31.4.50) with a password.
  • Now, exit from server 2.
  • Now, exit from server 2.

Steps for generating Passwordless Authentication:

To communicate two servers using SSH w/o password, follow the below instructions for successful password less authentication:

  • Generate ssh-keygen for password-less interaction on servers.
  • image
  • Generate ssh-keygen for password-less interaction on servers.
  • Change the directory into a user group.
  • Change the directory into a user group.
  • Ssh-copy-id <privateIP_server_two>
  • Ssh-copy-id <privateIP_server_two>
  • Now, you can connect server two from server one using ssh without a password.
  • Now, you can connect server two from server one using ssh without a password.

Summary:

These two ways (i) Communicate 2 servers using SSH and (ii) Generating ssh-keygen for password-less authentication is explained with instructions, commands, and screenshots to make your work easier.

Technologywe use

  • PHP
  • Angular
  • Android
  • Laravel
  • Salesforce
  • Tibco
  • Mulesoft