Generate an SSH key on macOS

At LRobSecure connection to your services requires SSH keys.
This step-by-step guide shows you how to generate an SSH key on your Mac.

1. Check for existing keys

Before creating a new key, make sure none already exists on your workstation.
Open the Terminal and run :

ls -al ~/.ssh

If you see files such as id_rsa.pub or id_ed25519.pubyou already have a key.

2. Generate a new SSH key

To create a new key, use the command :

ssh-keygen -t ed25519 -C "votre_email@example.com"
  • -t ed25519 recommended algorithm, fast and secure.
  • -C A comment (often your e-mail address).

💡 If your system is old and does not support Ed25519, use :

ssh-keygen -t rsa -b 4096 -C "votre_email@example.com"

3. Choose storage location

The Terminal offers :

Enter file in which to save the key (/Users/your_user/.ssh/id_ed25519):

Press Input to keep the default location.

4. Define a passphrase

You will be asked to define a passphrase (password associated with the key).
This step is optional, and forces you to re-enter your password each time you connect to SSH.

5 (Optional) Add key to SSH agent

If you use your SSH key regularly and would like to avoid retyping the passphrase for each connection, we recommend adding it to the macOS SSH agent.

First, activate the agent:

eval "$(ssh-agent -s)"

Then add your :

ssh-add ~/.ssh/id_ed25519

ℹ️ If you leave your key in its default location (~/.ssh/id_ed25519), it will be automatically recognized by SSH even without going through the agent.

6. Display public key

Once the key has been generated, you must transmit the public area of this key to your system administrator, or register it yourself in the administration interface (e.g. Plesk, menu SSH Keys).

To display the public key in your Terminal :

cat ~/.ssh/id_ed25519.pub

The content displayed looks like this:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB2n... comment

➡️ Copy the entire linewithout modification or line break.
It is this public key that will be used to authorize your secure access.

⚠️ Never share the private file (id_ed25519 without extension .pub).
Only the public key (.pub) must be shared.

7. Copy and authorize key

Copy the public key obtained in the previous step, then :

  • Give it to your administrator to add it to your account,
    or
  • Add it yourself via the SSH Keys in Plesk (extension available from LRob).

Once the key has been authorized, you can establish a secure connection to our services without a password.

Example:

ssh username@srvXX.lrob.net

🤖 LRobot, your AI assistant