What is SSH?

If you’ve been given access to a Lafayette server, you’ll need SSH (Secure Shell) to connect to it.

SSH keys are a safer way to log in than typing a password. Your computer proves who you are using a “key” — a matched pair of files that work like a lock and its key. This page shows you how to create and use SSH keys on Linux, macOS, and Windows.

SSH Keys on Linux, macOS, and Windows

You create SSH keys with a tool called ssh-keygen.

  • Linux and macOS: ssh-keygen is already built in, as part of a program called OpenSSH.
  • Windows 10 and newer: ssh-keygen is already built in, inside PowerShell and Command Prompt.
  • Older Windows systems: If your version of Windows doesn’t include ssh-keygen, you can get it through Git Bash, Windows Subsystem for Linux (WSL — a feature that lets Windows run Linux programs), or by installing separate software such as PuTTY or MobaXterm.

Lafayette’s systems require keys made in a specific format: OpenSSH Public Key format, created with the Ed25519 method. Ed25519 is the current standard for SSH keys.

The OpenSSH Public Key Format

An OpenSSH public key file (it ends in .pub) is one line of text made of three parts:

  1. Algorithm: the name of the method used — ssh-ed25519.
  2. Key blob: a long string of letters and numbers that is your actual key. For Ed25519 keys, this string is always 68 characters long.
  3. Comment: an optional note showing who owns the key, usually your username and computer name.
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5...[truncated]...j17s0v+oF user@hostname

Note: Lafayette can’t accept keys in two older formats: PEM (Privacy-Enhanced Mail) or SECSH. SECSH is described in RFC 4716 — “RFC” stands for Request for Comments, the naming system used for official internet standards. If your key is in one of these formats, create a new one using the steps below.

Creating SSH keys

The Files That Make Up an SSH Key

When you create an SSH key, your computer saves two files in a hidden folder called ~/.ssh/.

Both files start with id_ followed by the method name — for example, id_ed25519.pub and id_ed25519.

  • Public key (id_ed25519.pub): You can share this freely, including by adding it to services like GitHub.
  • Private key (id_ed25519): Never share this. Don’t email it, copy it to another computer, or post it anywhere.

Tip: On Linux and macOS, folder names that start with a period (like .ssh) are hidden automatically, so they won’t clutter your normal folder view.

To view your public key so you can share it, type this in your terminal, then copy the text it shows you:

cat ~/.ssh/id_ed25519.pub

Checking for Existing SSH Keys

Before making a new key, check whether you already have one. Type:

ls -al ~/.ssh

If you see files that start with id_, you already have a key. The one ending in .pub is public; the one with no ending is private.

If the ~/.ssh folder doesn’t exist, is empty, or has no id_ files (e.g., id_ed25519), you’ll need to make a new key using the steps below.

Note: You can use one key for several servers, but many people prefer separate keys for different systems.

Working with Linux and Apple macOS

Creating an SSH key works the same way on Linux and macOS. The only difference is where your home folder lives:

  • macOS: /Users/yourusername
  • Linux: /home/yourusername

You don’t need to remember this, though — just type ~/.ssh, and your computer will find the right folder either way.

Note: macOS can also store your key’s passphrase in Apple Keychain, so you don’t have to type it every time. This is the only real difference between the two systems.

Working with Windows

Creating an SSH key on Windows works almost the same way as on Linux and macOS. Modern versions of Windows already include the tools you need.

Open PowerShell or Command Prompt and type:

ssh-keygen -t ed25519 -C "user@example.com"

Windows saves your keys at C:\Users\yourusername\.ssh\

Note: Programs like PuTTY, Git Bash, or WSL can also create SSH keys, but using PowerShell or Command Prompt is the simplest way.

Adding a Passphrase to Your SSH Key

While your key is being created, you’ll be asked to enter a passphrase.

A passphrase locks your private key. Even if someone gets into your computer, they can’t use your key without also knowing the passphrase.

Best choice: Use a string of 4 or 5 random words, like purple garden lamp river. A phrase like this is easier to remember than a short, complicated password — and it’s harder to crack, too.

Skipping the passphrase: If you press Enter twice, your key won’t have a passphrase. This lets you log in without typing anything, but it also means anyone who gets your private key can use it right away. We recommend always setting a passphrase.

Step-by-Step: Creating an SSH Key

  1. Open your terminal. Use Terminal on Linux or macOS, or PowerShell/Command Prompt on Windows.
  2. Type this command, replacing netID with your own Lafayette NetID (your Lafayette username):
    ssh-keygen -t ed25519 -C "netID@lafayette.edu"
  3. Choose where to save it. Press Enter to accept the default location shown on your screen:
    Generating public/private ed25519 key pair.
    Enter file in which to save the key (/home/username/.ssh/id_ed25519): [Press Enter]

    If a key already exists there, you’ll see a message asking to overwrite it:

    /home/user/.ssh/id_ed25519 already exists.
    Overwrite (y/n)?

    Type n and press Enter to keep your existing key safe. Check whether you’re still using that key before replacing it.

  4. Set a passphrase. Type a passphrase, press Enter, then type it again to confirm:
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
  5. Confirm it worked. You’ll see a message showing where your key was saved and a “fingerprint” — a short code that identifies your key:
    Your identification has been saved in /home/username/.ssh/id_ed25519
    Your public key has been saved in /home/username/.ssh/id_ed25519.pub
    The key fingerprint is:
    SHA256:UqU2WDrh5ueCBPw9dfokFYn2ZnSsqtOgqBIRf04QnpU netID@lafayette.edu
  6. Share your public key. Copy the contents of id_ed25519.pub and send it to your system administrator.
Tagged in: