How to Generate an SSH Key to access your website files via SFTP

An SSH key lets you securely connect to your hosting account using the command line or an SFTP application, without relying on a password alone.

Your SSH key is made up of two parts:

  • Private key – stays on your computer. Never share this file with anyone.
  • Public key – added to your hosting control panel so it can recognise your computer.

This guide shows you how to create a new ed25519 SSH key, which is a modern and widely supported option.

Before you start

If you already have an SSH key that you use for other hosting accounts or services, you may be able to add the existing public key instead. You do not need to create a new one unless you would prefer to keep access separate.

Mac or Linux

  1. Open Terminal. On a Mac, you can find it in Applications > Utilities > Terminal.
  2. Enter the following command, replacing the email address with your own:
ssh-keygen -t ed25519 -C "[email protected]"
  1. You will be asked where to save the key. Press Enter to use the default location:
~/.ssh/id_ed25519
  1. You will then be asked to create a passphrase.

A passphrase adds another layer of protection to your private key and is recommended where practical. You can press Enter twice to continue without one.

  1. Your computer will generate two files:
id_ed25519
id_ed25519.pub

The file without .pub is your private key. Keep it secure.

The .pub file is your public key. This is the file you need to add to your hosting control panel.

To display your public key, enter:

cat ~/.ssh/id_ed25519.pub

Copy the complete line that appears, beginning with ssh-ed25519.

Windows 10 or Windows 11

  1. Open Windows Terminal or PowerShell. You can usually right-click the Start button and select one of these options.
  2. Most modern versions of Windows include OpenSSH. If the ssh-keygen command is not recognised, install the OpenSSH Client:
    • Go to Settings > Apps > Optional features
    • Select Add a feature
    • Search for OpenSSH Client
    • Select Install
  3. In PowerShell or Windows Terminal, enter the following command, replacing the email address with your own:
ssh-keygen -t ed25519 -C "[email protected]"
  1. When asked where to save the key, press Enter to accept the default location:
C:\Users\YourUsername\.ssh\id_ed25519
  1. You can create a passphrase when prompted, or press Enter twice if you do not want to use one.
  2. Windows will create two files:
id_ed25519
id_ed25519.pub

Keep id_ed25519 private. The id_ed25519.pub file is the public key that you can safely add to your hosting account.

To view the public key, run:

type $env:USERPROFILE\.ssh\id_ed25519.pub

To copy it directly to your clipboard, run:

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard

Add the public key to your hosting account

Once you have copied the public key, it should be provided to support via the helpdesk in Client Connect to facilitate access via SFTP to your hosting with O’Brien Media.

You can then use the key to connect through SSH or configure it in your preferred SFTP application.

Important security reminder

Never email, upload, or share your private key (id_ed25519). Only the public key, ending in .pub, should be provided to to facilitate access via SFTP to your hosting with O’Brien Media.

Last updated byChris Grant (he/him)Chris Grant (he/him)