Actions sur le document
Ssh avec une passphrase à vide
Configuration du serveur SSH
RhostsAuthentication no
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
IgnoreUserKnownHosts yes
Protocol 2
# HostKeys for protocol version 2HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
AllowGroups usersLoginGraceTime 30
PermitRootLogin no
StrictModes yes
PermitEmptyPasswords no
RSAAuthentication yesPubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
ChallengeResponseAuthentication yesPasswordAuthentication yes
PAMAuthenticationViaKbdInt yes
sudo /etc/rc.d/init.d/sshd restart
Arrêt de sshd : [ OK ]
Démarrage de sshd : [ OK ]
Configuration du client SSH
Création des clés sur la machine locale depuis le répertoire .ssh de votre home (ici /home/kwa29/.ssh, créer .ssh si il n'existe pas) :ssh-keygen -t dsa -b 1024
Generating public/private dsa key pair.
Enter file in which to save the key (/home/kwa29/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/kwa29/.ssh/id_dsa
Your public key has been saved in /home/kwa29/.ssh/id_dsa
The key fingerprint is:
XXXXXXXXXXXXXX
Copier sur le serveur distant la clé publique dans authorized_keys
Par scp sur la machine cliente
scp -P no_port /home/kwa29/.ssh/id_dsa.pub user@host:/home/MyRep
Sur la machine distante
cat id_dsa.pub > authorized_keys
chmod 600 authorized_keys
A ce stade depuis votre machine locale, et si vous avez laissé le passphrase à vide, vous pouvez vous connecter en tapant l'adresse compléte.Maintenant on va customiser la chose :
créez un fichier config dans votre .ssh (sur votre machine en local) dans lequel vous insérez ceci :
Host mon_nom
HostName your_hostname
Port 22
user moi
Maintenant un
ssh mon_nom
suffit pour vous connecter sans mot de passe !!!! Magique.
Si tout se passe bien vous devriez voir dans le /var/log/secure de la machine distante
Aug 7 18:20:59 localhost sshd[5644]: Accepted publickey for kwa29 from 192.168.100.1 port XXXX ssh2
