Nov 4, 2026 · @Jim Skon
An SSH key lets your Mac or Windows laptop log in to the class Ubuntu server without typing your password. It is a pair of matching files that you make on your laptop:
- The private key (
id_ed25519) stays on your laptop and is never shared. It works like a key that only you hold. - The public key (
id_ed25519.pub) goes on the server. It works like a lock that only your private key opens.
When you connect, the server checks that your laptop holds the matching private key, and lets you in. Once it is set up, ssh, scp and VS Code all connect without asking for a password. You do this once per laptop, and it takes about five minutes.
Before you start
- A terminal on your laptop. On a Mac, open the Terminal app (Command-Space, then type Terminal). On Windows 10 or 11, open PowerShell from the Start menu. Both already include the
sshtools; on Windows,ssh -Vshould print a version number. - A working password login. You should already be able to log in with
ssh yourusername@10.192.145.179and your password. You will type the password one last time in Step 2. - The campus network. The server’s address works only on campus. Off campus, connect to the college VPN first.
Every command below is typed on your laptop, not on the server, unless it says otherwise. If your prompt shows yourusername@servername, you are on the server; type exit to get back to your laptop.
Step 1: Make a key on your laptop
The command is the same on a Mac and on Windows:
ssh-keygen -t ed25519 -C "you@kenyon.edu"
-t ed25519 picks a modern, short key type, and -C adds a label so you can tell your keys apart later. The program then asks three questions:
- “Enter file in which to save the key”: press Enter to accept the default. If it says the file already exists, you already have a key. Type
n, skip to Step 2 and use that key. - “Enter passphrase”: either press Enter for no passphrase, or type one to protect the key if your laptop is ever stolen. Nothing appears as you type.
- “Enter same passphrase again”: press Enter again, or retype the passphrase.
It prints a fingerprint and a small picture made of characters; you can ignore both. You now have two files in a hidden .ssh folder in your home folder:
| Private key (keep secret) | Public key (safe to share) | |
|---|---|---|
| Mac | ~/.ssh/id_ed25519 | ~/.ssh/id_ed25519.pub |
| Windows | C:\Users\you\.ssh\id_ed25519 | C:\Users\you\.ssh\id_ed25519.pub |
Step 2: Copy the public key to the server
The server keeps the public keys it trusts in a file called ~/.ssh/authorized_keys in your home directory there. This step adds your public key to that file. Type your server password when asked; it is the last time you will need it.
Mac:
ssh-copy-id yourusername@10.192.145.179
It should finish with “Number of key(s) added: 1”.
Windows (PowerShell): Windows does not have ssh-copy-id, so paste this as one line, with your own username:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh yourusername@10.192.145.179 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Reading it left to right: type prints your public key, and | sends it through ssh to the server. On the server, mkdir -p makes the .ssh folder if it is missing, cat >> adds the key to the end of authorized_keys, and the two chmod commands make the folder and file private to you. The server ignores the file if other people can change it. If nothing is printed, it worked.
Step 3: Test it
ssh yourusername@10.192.145.179
If it logs you straight in, the key works. If you chose a passphrase in Step 1, it asks for the passphrase instead of your server password; that is also a success, and the optional section below shows how to stop it asking. Type exit to come back to your laptop.
If it still asks for your server password, see Troubleshooting at the end.
Optional: A short name for the server
An SSH config file lets you type ssh csserver instead of the full address. It lives next to your keys, at ~/.ssh/config on a Mac and C:\Users\you\.ssh\config on Windows, and has no .txt at the end.
The easiest way to edit it on either system is from VS Code with the Remote – SSH extension: open the Command Palette (Command+Shift+P or Ctrl+Shift+P), run Remote-SSH: Open SSH Configuration File, and choose the first file. Add these lines, with your own username:
Host csserver
HostName 10.192.145.179
User yourusernameSave the file. Now ssh csserver logs you in, scp hello.cpp csserver: copies a file to your home directory on the server, and VS Code lists csserver under Remote-SSH: Connect to Host. If you already added the server to VS Code by its address, you will see an entry like this one; you can rename its Host line to csserver.
Optional: Stop typing the passphrase
Skip this if you left the passphrase empty. Otherwise, a helper called the ssh agent can remember the unlocked key, so you type the passphrase once instead of on every login.
Mac: add the key to your Mac’s keychain:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Then add these lines to the top of ~/.ssh/config (see the previous section) so it is loaded automatically after a restart:
Host *
UseKeychain yes
AddKeysToAgent yesWindows: the agent is turned off by default. Right-click PowerShell in the Start menu, choose Run as administrator, and run:
Get-Service ssh-agent | Set-Service -StartupType Automatic Start-Service ssh-agent
Close that window, open an ordinary PowerShell, and add your key once:
ssh-add $env:USERPROFILE\.ssh\id_ed25519
The agent now starts with Windows and keeps your key, so ssh and VS Code stop asking.
Keeping your key safe
- Never share the private key (the file without
.pub), and never paste it into email, chat or a GitHub repository. Anyone who has it can log in as you. - Sharing the public key is fine. It is the same key you paste into GitHub when you set up git.
- One key per laptop. On a new laptop, make a new key and repeat Step 2, rather than copying the old private key across.
- Lost laptop? Log in from another computer and remove that laptop’s line from
~/.ssh/authorized_keyson the server withnano. Each line ends with the label you gave with-C, so you can tell which one it is.
Troubleshooting
| Problem | What to try |
|---|---|
| It still asks for your server password | Log in with your password and fix the permissions on the server: chmod go-w ~, chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys. Then check that cat ~/.ssh/authorized_keys shows the same line as your laptop’s id_ed25519.pub. |
ssh-copy-id is not recognized | You are on Windows. Use the PowerShell command in Step 2. |
Cannot find path ... id_ed25519.pub | The key was not made, or was saved under another name. Run Step 1 again and press Enter at the file question. |
Connection timed out | You are off the campus network. Connect to the college VPN. |
WARNING: UNPROTECTED PRIVATE KEY FILE! | On a Mac, run chmod 600 ~/.ssh/id_ed25519 on your laptop. |
REMOTE HOST IDENTIFICATION HAS CHANGED | The server’s identity is different from last time. Ask your instructor before doing anything; if the server was rebuilt, they will tell you to run ssh-keygen -R 10.192.145.179. |
Still stuck? Bring your laptop to the next class, or email your instructor the exact message you see.
