How to Use SSH Keys for Secure Login

SSH keys provide a more secure way to log into your server than passwords alone. This article explains how to generate an SSH key pair and add the public key to your server.

Generating an SSH Key Pair

On macOS or Linux, open a terminal and run:

ssh-keygen -t ed25519 -C "your-email@example.com"

Follow the prompts to save the key. You can press Enter to accept the default location.

On Windows, you can use PuTTYgen or Windows Terminal with OpenSSH.

Copying the Public Key to Your Server

Use the ssh-copy-id command:

ssh-copy-id -i ~/.ssh/id_ed25519.pub username@your-server-ip

Or manually add the contents of your .pub file to ~/.ssh/authorized_keys on the server.

Disabling Password Authentication

For maximum security, edit /etc/ssh/sshd_config and set:

PasswordAuthentication no
PubkeyAuthentication yes

Then restart the SSH service:

systemctl restart sshd

Need Help?

If you need assistance setting up SSH keys, contact us through the Circle City Servers Support Portal.

  • ssh keys, security
  • 0 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

How to Reset Your Server Password

If you've forgotten your server password or need to reset it for security reasons, Circle City...

How to Connect via RDP on Windows Servers

Remote Desktop Protocol (RDP) allows you to connect to your Windows server with a graphical...

How to Change Your SSH Port

Changing the default SSH port from 22 to a custom port can help reduce automated login attempts....

How to Change Your SSH Port

Changing the default SSH port from 22 to a custom port can help reduce automated login attempts....

Troubleshooting Network Connectivity Issues

If you are unable to reach your server, this guide will help you identify and resolve common...