Public key authentication

From Linuxintro
Revision as of 06:40, 18 October 2008 by imported>ThorstenStaerk

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

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:~ #