How to Setup SSH Passwordless login in 5 easy steps

In this Post we will discuss How to Setup SSH Passwordless login in 5 easy steps.

SSH

SSH(Secure shell) is a software package that enables secure system administration and file transfers over insecure networks.
In this post, we will show you ssh passwordless login on Red-Hat, CentOS, Ubuntu and Oracle Linux using ssh keys to connect to remote Linux servers without entering a password. Using Password-less login with SSH keys.
ssh passwordless login

If you are connecting with a number of Linux remote servers, then SSH Password-less login is one of the best ways to automate tasks.

Test Environment Lab Setup
 
  • SSH Client Host: 192.168.56.104
  • SSH Remote Host: 192.168.56.101

In this example, we will set up SSH password-less automatic login from client server 192.168.56.101 as user xymon to remote server 192.168.56.104 with user xymon.

How to do SSH passwordless authentication in Linux?.
 
Step 1:
 
Create Authentication SSH-Keygen Keys on Client host (192.168.56.104).
First login into client server 192.168.56.104 with user xymon and generate a pair of public keys using the following command.
ssh passwordless login

Step 2:

Create .ssh Directory on Remote server –  192.168.56.101. Use SSH from server 192.168.56.104 to connect server 192.168.56.101 using xymon as a user and create .ssh directory under it, using the following command.

  • [xymon@myaansible ~]$ ssh xymon@192.168.56.101 mkdir -p .ssh
  • xymon@192.168.56.101’s password:         “Enter your Password

Step 3:

Upload Generated Public Keys on Remote Host – 192.168.56.101. Use SSH from client server 192.168.56.104 and upload a new generated public key (id_rsa.pub) on Remote server 192.168.56.101 under xymon‘s .ssh directory as a file name authorized_keys.

  • [xymon@myaansible ~]$ cat .ssh/id_rsa.pub | ssh xymon@192.168.56.101 ‘cat >> .ssh/authorized_keys’
  • xymon@192.168.56.101’s password:            “Enter your Password

Step 4:

Set Permissions on Remote server – 192.168.56.101 .We need to set permissions on Remote server for .ssh directory and authorized_keys file.

  • ssh xymon@192.168.56.101 “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

Step 5:

Login from client server 192.168.56.104 to remote server 192.168.56.101 Server without Password.

Leave your message if anything missed and we appreciate your comments. You can also watch this video “Setup Passwordless SSH Login”. Click Next

Related Posts

Leave a Reply

Your email address will not be published.