Authentification SSH par clés
-
<p style="text-align: center;"><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size: 20px;"><strong>Authentification SSH par clés</strong></span></span></p><p> </p><p style="text-align: justify;"><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Le SSH (Secure Shell) permet d'obtenir un <strong>accès à distance à une machine UNIX</strong>. Par défaut, vous devez vous connecter à l'aide de votre identifiant et de votre mot de passe que vous utilisez habituellement pour vous connecter sur cette machine en local. Néanmoins, on peut utiliser <strong>l'authentification pas clés pour améliorer la sécurité et ne plus avoir à saisir de mot de passe</strong>. Il faut toute fois faire <strong>attention à ce que votre ordinateur soit privé et sécurisé</strong> sinon n'importe qui pourra accéder à votre machine distante.</span></p><p></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><strong><span style="font-size: 18px;">1. Génération de la clé</span></strong></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><hr/></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Sur votre orindateur, <strong>installez le paquet </strong></span><span style="font-family:courier new,courier,monospace;"><strong>ssh</strong> </span><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">:</span></p><pre class="html ipsCode prettyprint" data-pbcklang="html" data-pbcktabsize="4"><span style="font-family:courier new,courier,monospace;">sudo apt-get install ssh</span></pre><p> </p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Puis, <strong>générez une clé SSH</strong> avec cette commande :</span></p><pre class="html ipsCode prettyprint" data-pbcklang="html" data-pbcktabsize="4"><span style="font-family:courier new,courier,monospace;">ssh-keygen -b 4096</span></pre><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="color: rgb(0, 0, 255);"><strong>Note :</strong></span> L'argument -b de la commande permet de générer une clé d'une longueur définie par l'utilisateur (par défaut : 2048).</span></p><p></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size: 18px;"><strong>2. Exportation de la clé publique sur la machine distante</strong></span></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><hr/></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Dans votre shell préféré, tapez la commande suivante :</span></p><pre class="html ipsCode prettyprint" data-pbcklang="html" data-pbcktabsize="4"><span style="font-family:courier new,courier,monospace;">ssh-copy-id <em>user</em>@<em>server</em></span></pre><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><strong><span style="color: rgb(0, 0, 255);">Note :</span></strong> L'argument -i permet de spécifier le chemin de la clé publique à exporter.</span></p><p></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size: 18px;"><strong>3. Connexion à la machine distante</strong></span></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><hr/></span></p><p><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Vous pouvez connecter dès à présent à votre machine distante sans avoir besoin de taper votre mot de passe :</span></p><pre class="html ipsCode prettyprint" data-pbcklang="html" data-pbcktabsize="4">ssh <em>user</em>@<em>server</em></pre>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
</p>