ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Hack:   Quick Logins with ssh Client Keys
Subject:   Works perfect to me!
Date:   2010-01-20 05:12:55
From:   Nap2k10
Here you have my case as example:


root@er1smc1>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in //.ssh/id_rsa.
Your public key has been saved in //.ssh/id_rsa.pub.
The key fingerprint is:
1a:c9:6f:a5:4e:72:80:05:d7:05:3c:bb:6a:20:0a:5b root@er1smc1


root@er1smc1>pwd
/.ssh


root@er1smc1>ls -lrt
total 8
-rw-r--r-- 1 root root 1331 Jan 20 11:51 known_hosts
-rw------- 1 root root 883 Jan 20 14:50 id_rsa
-rw-r--r-- 1 root root 222 Jan 20 14:50 id_rsa.pub
root@er1smc1>sftp one@192.168.2.92
Connecting to 192.168.2.92...
Password:
sftp> cd .ssh
sftp> ls
.
..
known_hosts
sftp> put id_rsa.pub
Uploading id_rsa.pub to /home/one/.ssh/id_rsa.pub
sftp> bye


root@er1smc1>ssh one@192.168.2.92
Password:
linux1$ cd .ssh/
linux1$ ls
id_rsa.pub known_hosts
linux1$ ls -lrt
total 8
-rw-r--r-- 1 one one 227 Feb 12 2009 known_hosts
-rw-r--r-- 1 one one 222 Jan 20 16:47 id_rsa.pub
linux1$ mv id_rsa.pub authorized_keys2
linux1$ bye
linux1$ exit
logout
Connection to 192.168.2.92 closed.


root@er1smc1>ssh one@192.168.2.92 !NO password!
linux1$ exit
logout