Tutorials

Set Up SSH Keys in 5 Minutes

November 19, 2026 · 1 min read · admin
Glowing key above an ssh-keygen command

Logging into your servers with a password works, but it’s slow and easier to attack. SSH keys are faster and much more secure. Here’s how to set them up from Windows, Mac or Linux.

Step 1: Create your key

Open a terminal (PowerShell on Windows) and run:

ssh-keygen -t ed25519

Press Enter to accept the default location. Adding a passphrase is a good idea, because it protects the key if your computer is ever stolen.

Step 2: Copy it to your server

On Mac or Linux:

ssh-copy-id user@your-server

On Windows (PowerShell), which doesn’t have ssh-copy-id:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh user@your-server "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

You’ll type your password one last time.

Step 3: Test it

ssh user@your-server

If you get in without being asked for the server password, it worked.

Step 4 (optional): Turn off password logins

Once keys work, you can block password logins completely. On the server, edit /etc/ssh/sshd_config, set PasswordAuthentication no, and restart SSH:

sudo systemctl restart ssh

Tip: keep your current session open while you test a new login in a second window. If something’s wrong, you can still fix it without locking yourself out.

Leave a Reply

Your email address will not be published. Required fields are marked *