Jump to content

Generate an SSH Key

From Wikitech

This page contains information about generating a public SSH Key. If you are generating a key for production access, please see SRE/Production access#Generating your SSH key.

Generate an SSH key

To generate the SSH key pair for Wikimedia Cloud Services (such as Toolforge or Cloud VPS), you can perform the procedure on your own computer. You can use your operating system's native terminal:

On Windows: run the commands below in the native Command Prompt, PowerShell, or Git Bash (the OpenSSH comes pre-installed on Windows 10/11).

On Linux / macOS: use your distribution's or system's native terminal.

### Generate SSH key
ssh-keygen -t ed25519 -C "your_email@youremail.com"  # Replace email's value, save on default filename, type your passphrase
cat ~/.ssh/id_ed25519.pub             # Public key, to copy into your other tools
# ~/.ssh/id_ed25519                   # Private key, keep this private!

The terminal will ask where to save the key ("Enter file in which to save the key"); simply press Enter to accept the default location (~/.ssh/id_ed25519). Next, enter a passphrase (strong password) to protect your private key and confirm it. Finally, it will display the messages: "Your identification has been saved in .ssh/id_ed25519" and "Your public key has been saved in .ssh/id_ed25519.pub".

A fingerprint and randomart image for the key will also be generated...

Such as for example: "The key fingerprint is: SHA256:xxxxxxxxxxx your_email@youremail.com"

Acess idm.wikimedia.org/keymanagement/create/, and paste the public key into the "SSH public key" field.

Add or Change a passphrase

Add or change the SSH passphrase using this command:

  1. Enter the following into your terminal $ ssh-keygen -p, and press Enter.
  2. When prompted Enter file in which the key is (/Users/you/.ssh/id_rsa):, type the location of your key and press Enter.
  3. Enter your old passphrase, and press Enter.
  4. Enter the same passphrase again, and press Enter.
  5. our identification has been saved with the new passphrase.

Notes

  • Make sure to choose a passphrase. Do not leave it empty.
  • ssh-agent can be used to store your passphrase securely, so you do not have to re-enter it.
  • Mac OS X Leopard or later and Linux users SSH can save their passphrase in the system's keychain.

See also