Installation d'une clé ssh sur un serveur distant. 1) Installation du paquetage client :
[~] ➔ sudo apt-get install openssh-client
2) Génération des clés publiques et privées:
[~] ➔ ssh-keygen -t dsa -b 1024
Generating public/private dsa key pair.
Enter file in which to save the key (/home/util01/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/util01/.ssh/id_dsa.
Your public key has been saved in /home/util01/.ssh/id_dsa.pub.
The key fingerprint is:
47:63:02:dd:5e:a5:92:0e:eb:80:df:4d:cd:07:3b:6a util01@station
The key's randomart image is:
+--[ DSA 1024]----+
| .. . .. |
| .. .... |
| o.*.o |
| . B.= o |
| . . S + = . |
| . + + . o |
| . o E |
| . |
| |
+-----------------+
3) Copier la clé publique sur le serveur :
[~] ➔ ssh-copy-id -i ~/.ssh/id_dsa.pub pi@192.168.1.12
pi@192.168.1.12's password:
Now try logging into the machine, with "ssh 'pi@192.168.1.12'", and check in:
~/.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
4) Connexion vers le serveur distant : Aucun mot de passe n'est demandé.
[~] ➔ ssh pi@192.168.1.12
Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l
Last login: Sun Jun 14 00:34:11 2015 from station.home
[~] ➔