Monday, January 7, 2008

How to setup passwordless SSH?

Here is the step by step process (screenlogs) as to how I setup password-less SSH for ABCGRID1 server from ABCNETBACKUP.



login as: unixgeek
unixgeek @ 10.10.10.13 password:

Last login: Mon Oct 29 13:21:05 2007 from abcgrid1.somecompany.com
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

Seting the DISPLAY to 047-lkhla5f.somecompany.com:0.0
Welcome to abcnetbackup

$ hostname;pwd
abcnetbackup
/export/home/unixgeek

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/unixgeek/.ssh/id_rsa):
Created directory '/export/home/unixgeek/.ssh'.
Enter same passphrase again:
Your identification has been saved in /export/home/unixgeek/.ssh/id_rsa.
Your public key has been saved in /export/home/unixgeek/.ssh/id_rsa.pub.
The key fingerprint is:
ef:55:ab:2e:75:12:b1:5e:46:50:d3:db:fd:bf:d1:31

$ cd .ssh

$ ls
id_rsa id_rsa.pub

$ cat id_rsa.pub >> authorized_keys

$ mkdir ALL_KEYS

$ cp -p id_rsa.pub ALL_KEYS/id_rsa.pub.abcnetbackup

$ scp -p ALL_KEYS/id_rsa.pub.abcnetbackup abcgrid1:/export/home/unixgeek/.ssh/ALL_KEYS/
The authenticity of host 'abcgrid1 (10.10.10.100)' can't be established.
RSA key fingerprint is 31:93:d3:90:19:75:44:f2:b9:27:32:57:3a:88:eb:3f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'abcgrid1,10.10.10.100' (RSA) to the list of known hosts.
unixgeek @ abcgrid1 password:
id_rsa.pub.abcnetbackup 100% 400 0.4KB/s 00:00

$ cd ALL_KEYS

$ ls
id_rsa.pub.abcgrid1 id_rsa.pub.abcnetbackup

$ cat id_rsa.pub.abcgrid1 >> ../authorized_keys

$ ssh abcgrid1
Last login: Mon Oct 29 13:35:51 2007 from 047-lkhla5f.somecompany.com
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Seting the DISPLAY to abcnetbackup.somecompany.com:0.0
Welcome to abcgrid1
$

2 comments:

muthu said...

setting up sftp between mainframe server and solaris server same procedure or the steps differ?
is it ok if one server i use openssh lower version and other server i use openssh higher version?

Unix Geek said...

@Muthu: I have no idea about mainframes as such .. but if it OpenSSH, then it should work same way.