Skip to main content

Create and manage SSH keys

T
Written by Team Pressidium
Updated this week

Feature available on: Pressidium Managed Hosting

SSH access is enabled on demand. Please reach out to our support team to request SSH access activation.

Setting up SSH keys (an SSH key pair), is a requirement before accessing your website via SSH (Secure Shell Protocol). When you connect via SSH, you authenticate using a private key file on your local machine and a matching public key uploaded to your Dashboard.

Prerequisites

You can inspect and generate new SSH keys by using the ssh-keygen command line utility. macOS and Linux usually have this already installed and available via a Terminal application. If you are using Windows we recommend using Git Bash (a shell that comes bundled with Git for Windows) that provides a Windows compatible version. Windows Terminal has "out of the box" support for Git Bash.

Checking for and using existing keys

Before you generate a new SSH key, you should check your local machine for existing keys. SSH keys are commonly stored in the HOME directory in the .ssh folder. List the directory contents to see if any existing keys are available and can be used:

$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist

Public keys have the .pub extension. e.g. id_rsa.pub. You can inspect the contents of a public key file by using the cat command:

$ cat ~/.ssh/id_rsa.pub
ssh-rsa MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvbEpCTCPXFFQ94mbqJA8
BYllNSDvxV/xMjWs5KHuQTAjnfd81CJd/tEMABM1JfkfFAe3aOzNLo/Ol/HlEGb2
xzHvp7o6YndqwV7IaMzfuvDFtKfOvGxnl+jXg+YzzMEOp9rrnvOjRbDRDfIXeRYM
1yc05J4RkNAupOU8XXb1q1KOCn1GL359RfTzIzOykRfvSSfguKpapfGPNoJQoLt2
TVfArlYl5vep5gpAq5QPP3H33znPFt6+4UENYJVHRFsHJKPaS3M2z/siq2Z3S4eh
WcZqi83Jzak2TyD0Ifla8+u4upZ3swuQdzKGR2MYHX2x+M5Pcvei4HRrfmdBzqIt
PQIDAQAB

Important: Only ssh-rsa type keys ares supported for now. If your existing keys are

using a different algorithm like ecdsa or ed25519 they cannot be used and you will need to create a new key.

Upload your public key to the Dashboard:

  • From the sidebar navigate to Personal settings.

  • Locate the SSH Keys section.

  • Click Add SSH Key.

  • Copy your public key file contents to the public key input field. DO NOT copy the contents of your private key.

  • Give the key a distinctive title to be able to recognize it.

Creating a new SSH key

If don't have an existing, supported, SSH public and private key pair, or don't wish to use any that are available, you can generate a new SSH key. You can create a new one by using ssh-keygen. Open your terminal (on Windows you can use Git Bash) and type the following:

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

This will attempt to create a new SSH key using the provided email as a label.

Generating public/private rsa key pair.

ssh-keygen will prompt you to "Enter a file in which to save the key", you can press Enter to accept the default file location.

Enter file in which to save the key (/home/myusername/.ssh/id_rsa):

Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case we recommend creating a custom-named SSH key. To do so, type the default file location and replace id_ALGORITHM with your custom key name.

You will be prompted to secure your key with a passphrase (optional, default is empty):

> Enter passphrase (empty for no passphrase): [Type a passphrase] 
> Enter same passphrase again: [Type passphrase again]

If you do use a passphrase it is recommend to setup ssh-agent to automatically provide the password upon using the key.

ssh-keygen will generate the public-private key pair and display the key information in the terminal, e.g:

Your identification has been saved in /home/myusername/.ssh/id_rsa
Your public key has been saved in /home/myusername/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Ok1rqh8WHxpjWspwA3UlOIs81ae984WW/vY56G82aN0 my_email@example.com
The key's randomart image is:
+---[RSA 4096]----+
| .oo.. |
| .+.... |
| ..o o + |
| +.. . . |
| ..o * S. o |
| + * Xoo+ . |
| + * == . + . |
| . = o = *.E|
| .oo =o=+o |
+----[SHA256]-----+
  • id_rsa (or the custom name you provided) contains the private key.

  • id_rsa.pub (or the custom name you provided with the .pub extension) contains the public key.

Upload your public key to the Dashboard:

  • From the sidebar navigate to Personal settings.

  • Locate the SSH Keys section.

  • Click Add SSH Key.

  • Copy your public key file contents to the public key input field. DO NOT copy the contents of your private key.

  • Give the key a distinctive title to be able to recognize it.

Did this answer your question?