Passwordless SSH connection setup between Linux Nodes

What is SSH: Secure Shell (SSH) is an open source cryptographic network protocol for operating network services securely over an unsecured network. The best-known example application is for remote login to computer systems by users. SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server.

What is SSH-KEYGEN: ssh-keygen is a standard component of the Secure Shell (SSH) protocol suite found on Unix and Unix-like computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques. The ssh-keygen utility is used to generate, manage, and convert authentication keys. ssh-keygen is able to generate a key using one of three different digital signature algorithms.

Test Case: In our example, we will setup SSH password-less automatic login from server user1@tstserver001 to server user2stserver002
SSH Client: user1@tstserver001
SSH Remote Host: user2stserver002

  1. Frist attempt to log in without setting up SSH keys, we will be prompted for the password.

ssh1

 

Now let’s create a SSH Key on user1@tstserver001

ssh2.jpg

 Now that our Public Key has been created (/home/user1/.ssh/id_rsa.pub), we can now upload that to any node to setup Password-less connection.

2. Create .SSH directory on user2@tstserver2 if it doesn’t exist.

ssh3.jpg

3. Upload and append the Public Key (id_rsa.pub) on server user2@tstserver2

ssh4.jpg

4. Set Permissions on Remote Host (user2@tstserver002)

ssh5.jpg

 

  • Alternate ways to do Step 3 and 4, you also Secure Copy the Public Key (id_rsa.pub) file and then append.ssh6.jpg

5. Test Logging in from [user1@tstserver001]$ to [user2@tstserver002]

From now, you can log in to [user2@tstserver002] from [user1@tstserver001] without the password.

ssh7.jpg

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s