Thursday 15 February 2007

Using public keys for SSH authentication

With the ssh freeware utilities we can login on a Ubuntu server without type a password.
Example :

follow these steps:

user@hostname:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): (type nothing)
Enter same passphrase again: (type nothing)
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
2e:24:d1:d9:f2:43:fc:6c:89:91:be:7e:db:a5:99:bf user@hostname
user@hostname:~$
user@hostname:~$
user@hostname:~$ scp /home/user/.ssh/id_rsa.pub root@server_hostname:/root/authorized_keys
root@server_hostname's password: (type password of root )
id_rsa.pub 100% 408 0.4KB/s 00:00
user@hostname:~$
user@hostname:~$ ssh -l root server_hostname
root@server_hostname's password: (type password of root )
user@server_hostname:~$ mkdir .ssh
user@server_hostname:~$ mv authorized_keys .ssh/
user@server_hostname:~$ exit
logout
Connection to server_hostname closed.
user@hostname:~$
user@hostname:~$ ssh root@server_hostname
user@server_hostname:~$ You enter in the server without type a password !!!!!!!!!!!!!!

Labels: , ,

1 Comments:

Anonymous Anonymous said...

Good for people to know.

11 November 2008 at 08:00  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home