How to setup password less ssh login in linux server

SSH is an open-source and most trusted network protocol that is use to login to remote server. It is use to transfer file from one host to remote host over the network using SCP protocol.

Source server 1.2.3.4

Destination server 5.6.7.8

First of all login on source server 1.2.3.4 and generate pair of public keys using below command.

Step 1:- Generate public authentication keys on 1.2.3.4

[root@backup ~]# ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

4d:05:39:fc:42:84:b6:e7:29:55:ee:32:dh:8b:ff:19 root@backup.xx-xxxx.com

Step 2:- Create .ssh Directory on – 5.6.7.8

ssh root@5.6.7.8 mkdir -p .ssh

Step 3: Copy/Upload Generated Public Keys to – 5.6.7.8

cat .ssh/id_rsa.pub | ssh root@5.6.7.8 ‘cat >> .ssh/authorized_keys’

Step 4:- Set permission on 5.6.7.8

The most common issue is permission on remote server. The permissions of the directories should be

chmod 700 .ssh; chmod 640 .ssh/authorized_keys

Step 5 :- Login from 1.2.3.4 to 5.6.7.8 without password.

$ssh root@5.6.7.8

Recent Posts

Start typing and press Enter to search