Difference between revisions of "Public key authentication"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 9: Line 9:
 
  The key fingerprint is:
 
  The key fingerprint is:
 
  b7:b4:64:73:ef:4e:8a:df:d2:8c:16:ca:df:08:48:ec ''root''@''earth''
 
  b7:b4:64:73:ef:4e:8a:df:d2:8c:16:ca:df:08:48:ec ''root''@''earth''
copy your public key to ''mars'':
+
''mars'' must know your public key and understand it is authorized. So, copy your public key to ''mars'':
 
  scp /root/.ssh/id_dsa.pub root@mars:/root/.ssh/authorized_keys
 
  scp /root/.ssh/id_dsa.pub root@mars:/root/.ssh/authorized_keys
 
Now you can securely login without having to give your password.
 
Now you can securely login without having to give your password.

Revision as of 06:48, 18 October 2008

With Linux, it is possible to log in to a remote computer without having to type a password. You authenticate yourself with your "digital signature" and your public key. Let's say you are root on computer earth and want to log in to mars. Start creating a public/private key pair:

ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
b7:b4:64:73:ef:4e:8a:df:d2:8c:16:ca:df:08:48:ec root@earth

mars must know your public key and understand it is authorized. So, copy your public key to mars:

scp /root/.ssh/id_dsa.pub root@mars:/root/.ssh/authorized_keys

Now you can securely login without having to give your password.

earth:~ # ssh root@mars
Last login: Sun Oct  5 21:00:50 2008 from tweedleburg.site
Have a lot of fun...
mars:~ #