{"id":8224,"date":"2025-08-26T16:43:59","date_gmt":"2025-08-26T14:43:59","guid":{"rendered":"https:\/\/www.lrob.fr\/?page_id=8224"},"modified":"2025-08-26T16:45:37","modified_gmt":"2025-08-26T14:45:37","slug":"generating-an-ssh-key-on-macos","status":"publish","type":"page","link":"https:\/\/www.lrob.fr\/en\/doc\/administration\/generer-une-cle-ssh-sur-macos\/","title":{"rendered":"Generate an SSH key on macOS"},"content":{"rendered":"<p>At <strong>LRob<\/strong>Secure connection to your services requires SSH keys.<br>This step-by-step guide shows you how to generate an SSH key on your Mac.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Contents<\/h2><nav><ul><li><a href=\"#1-verifier-la-presence-de-cles-existantes\">1. Check for existing keys<\/a><\/li><li><a href=\"#2-generer-une-nouvelle-cle-ssh\">2. Generate a new SSH key<\/a><\/li><li><a href=\"#3-choisir-lemplacement-de-stockage\">3. Choose storage location<\/a><\/li><li><a href=\"#4-definir-une-passphrase\">4. Define a passphrase<\/a><\/li><li><a href=\"#5-optionnel-ajouter-la-cle-a-lagent-ssh\">5 (Optional) Add key to SSH agent<\/a><\/li><li><a href=\"#6-afficher-la-cle-publique\">6. Display public key<\/a><\/li><li><a href=\"#7-copier-et-autoriser-la-cle\">7. Copy and authorize key<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-verifier-la-presence-de-cles-existantes\">1. Check for existing keys<\/h2>\n\n\n\n<p>Before creating a new key, make sure none already exists on your workstation.<br>Open the <strong>Terminal<\/strong> and run :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls -al ~\/.ssh<\/code><\/pre>\n\n\n\n<p>If you see files such as <code>id_rsa.pub<\/code> or <code>id_ed25519.pub<\/code>you already have a key.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-generer-une-nouvelle-cle-ssh\">2. Generate a new SSH key<\/h2>\n\n\n\n<p>To create a new key, use the command :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t ed25519 -C \"votre_email@example.com\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-t ed25519<\/code> recommended algorithm, fast and secure.<\/li>\n\n\n\n<li><code>-C<\/code> A comment (often your e-mail address).<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udca1 If your system is old and does not support Ed25519, use :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t rsa -b 4096 -C \"votre_email@example.com\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-choisir-lemplacement-de-stockage\">3. Choose storage location<\/h2>\n\n\n\n<p>The Terminal offers :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enter file in which to save the key (\/Users\/your_user\/.ssh\/id_ed25519):<\/code><\/pre>\n\n\n\n<p>Press <strong>Input<\/strong> to keep the default location.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-definir-une-passphrase\">4. Define a passphrase<\/h2>\n\n\n\n<p>You will be asked to define a passphrase (password associated with the key).<br>This step is optional, and forces you to re-enter your password each time you connect to SSH.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-optionnel-ajouter-la-cle-a-lagent-ssh\">5 (Optional) Add key to SSH agent<\/h2>\n\n\n\n<p>If you use your SSH key regularly and would like to <strong>avoid retyping the passphrase<\/strong> for each connection, we recommend adding it to the macOS SSH agent.<\/p>\n\n\n\n<p>First, activate the agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>eval \"$(ssh-agent -s)\"<\/code><\/pre>\n\n\n\n<p>Then add your :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-add ~\/.ssh\/id_ed25519<\/code><\/pre>\n\n\n\n<p>\u2139\ufe0f If you leave your key in its default location (<code>~\/.ssh\/id_ed25519<\/code>), it will be automatically recognized by SSH even without going through the agent.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-afficher-la-cle-publique\">6. Display public key<\/h2>\n\n\n\n<p>Once the key has been generated, you must transmit <strong>the public area<\/strong> of this key to your system administrator, or register it yourself in the administration interface (e.g. Plesk, menu <strong>SSH Keys<\/strong>).<\/p>\n\n\n\n<p>To display the public key in your Terminal :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat ~\/.ssh\/id_ed25519.pub<\/code><\/pre>\n\n\n\n<p>The content displayed looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB2n... comment<\/code><\/pre>\n\n\n\n<p>\u27a1\ufe0f <strong>Copy the entire line<\/strong>without modification or line break.<br>It is this public key that will be used to authorize your secure access.<\/p>\n\n\n\n<p>\u26a0\ufe0f Never share the private file (<code>id_ed25519<\/code> without extension <code>.pub<\/code>).<br>Only the public key (<code>.pub<\/code>) must be shared.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-copier-et-autoriser-la-cle\">7. Copy and authorize key<\/h2>\n\n\n\n<p>Copy the public key obtained in the previous step, then :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Give it to your administrator<\/strong> to add it to your account,<br><strong>or<\/strong><\/li>\n\n\n\n<li><strong>Add it yourself<\/strong> via the <strong>SSH Keys<\/strong> in Plesk (extension available from <strong>LRob<\/strong>).<\/li>\n<\/ul>\n\n\n\n<p>Once the key has been authorized, you can establish a secure connection to our services without a password.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh username@srvXX.lrob.net<\/code><\/pre>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Chez LRob, la connexion s\u00e9curis\u00e9e \u00e0 vos services passe par l\u2019utilisation de cl\u00e9s SSH.Ce guide vous explique, \u00e9tape par \u00e9tape, comment g\u00e9n\u00e9rer une cl\u00e9 SSH sur votre Mac. 1. V\u00e9rifier la pr\u00e9sence de cl\u00e9s existantes Avant de cr\u00e9er une nouvelle cl\u00e9, assurez-vous qu\u2019il n\u2019en existe pas d\u00e9j\u00e0 sur votre poste.Ouvrez le Terminal et ex\u00e9cutez : [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5919,"parent":6341,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-8224","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/pages\/8224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/comments?post=8224"}],"version-history":[{"count":2,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/pages\/8224\/revisions"}],"predecessor-version":[{"id":8226,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/pages\/8224\/revisions\/8226"}],"up":[{"embeddable":true,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/pages\/6341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/media\/5919"}],"wp:attachment":[{"href":"https:\/\/www.lrob.fr\/en\/wp-json\/wp\/v2\/media?parent=8224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}