Showing posts with label Passwordless. Show all posts
Showing posts with label Passwordless. Show all posts

Tuesday, October 17, 2017

SSH Password less Login Using SSH Keygen

To configure SSH Passwordless Login Using SSH Keygen.
Find My Scenario to configure.

SSH Client : 192.168.1.193 ( CentOS 7 )
SSH Remote Host : 192.168.1.47 ( CentOS 7 )
Step 1: Create Authentication SSH-Kegen Keys on – (192.168.1.193 – Client)

First login into server 192.168.1.193 with user root and generate a pair of public keys using following command.

[root@gcdc-nms opt]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/rsync_key
Enter passphrase (empty for no passphrase): [Hit Enter]
Enter same passphrase again: [Hit Enter]
Your identification has been saved in /root/.ssh/rsync_key.
Your public key has been saved in /root/.ssh/rsync_key.pub.
The key fingerprint is:
SHA256:9hAlaN2gBCOmbIVv4QcGOiMSZp9yIHcVFgeWvHizo/4 root@gcdc-nms.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|o=*.++OB+o.      |
|**+*.==o.o.      |
|B+++oo...        |
|+oo+..+  .       |
|  . .. oS        |
|      o. o       |
|     . .  .      |
|    .            |
|   ...E          |
+----[SHA256]-----+


Step 2: Create .ssh Directory on – 192.168.1.47 (Server)

# ssh root@192.168.1.47 mkdir -p .ssh

Step 3: Upload Generated Public Keys to – 192.168.1.47 (Go to 192.168.1.193 – Client)

# cat .ssh/id_rsa.pub | ssh root@192.168.1.47 'cat >> .ssh/authorized_keys'

Step 4: Set Permissions on – 192.168.1.47 (Server)

# ssh root@192.168.1.47 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

Step 5: Login from 192.168.1.193 (Client) to 192.168.1.47 (Server) Server without Password

# ssh root@192.168.1.47