Monday, September 12, 2011

ssh-keygen - password less login

To login From HostA To HostB Hostc, HostD HostE etc .... with out password.


On HOSTA (From where you connect)

$ ssh-keygen -t rsa

This will create a file
id_rsa.pub inside /home/user/.ssh

File:-  id_rsa.pub is a Public Key
File:-  id_rsa is a Private Key ( No need to copy this)



Now need to copy the id_rsa.pub(inside /home/user/.ssh/) to all hosts you want to login password less (for eg. to login to HostB,HostC,HostD,HostE etc...)

Enter password after prompting on below commands once.
$ssh-copy-id -i /scratch/aime/.ssh/id_rsa.pub oracle@hostb.us.oracle.com
$ssh-copy-id -i /scratch/aime/.ssh/id_rsa.pub oracle@hostc.us.oracle.com
$ssh-copy-id -i /scratch/aime/.ssh/id_rsa.pub oracle@hostd.us.oracle.com
$ssh-copy-id -i /scratch/aime/.ssh/id_rsa.pub oracle@hoste.us.oracle.com


Now Try:

$ ssh oracle@Hostb
Last login: Mon Sep 12 17:23:06 2011 from dhcp-singapore-test-1-vpnpool-10-191-74-134.vpn.hosta.com
[oracle@hosta ~]$

Likewise try:
$ ssh oracle@hostc

$ ssh oracle@hostd

$ ssh oracle@hoste

This will connect without password.
















No comments:

Post a Comment