Wednesday, August 24, 2016

Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

Step 1: Create public and private keys using ssh-key-gen on host jagan.abs.com


[oracle@jagan ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):Enter
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):Enter
Enter same passphrase again:Enter
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
c9:31:0c:a6:b6:fc:ad:f7:bf:fa:a1:c5:b1:e5:24:11 oracle@jagan.abs.com
[oracle@jagan ~]$


Step 2: Copy the public key to sahiti.abs.com using ssh-copy-id


[oracle@jagan ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub sahiti.abs.com
28
The authenticity of host 'sahiti.abs.com (192.168.142.130)' can't be established.
RSA key fingerprint is d7:73:15:b9:17:e3:9b:2d:19:b8:13:9e:e8:a5:cd:ef.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'sahiti.abs.com,192.168.142.130' (RSA) to the list of known hosts.
oracle@sahiti.abs.com's password:Enter password
Now try logging into the machine, with "ssh 'sahiti.abs.com'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[oracle@jagan ~]$

Step 3: Login to sahiti.abs.com without entering the password

[oracle@jagan ~]$ ssh sahiti.abs.com
[oracle@sahiti ~]$



Completed...............

No comments:

Post a Comment