TL;DR: How to set up SSH key login and turn off password login

KB ID 2610140007

The fix only. No explanation, no diagnosis. Read the full article if any of this does not match what you are seeing.

  1. On your own machine, make a key with a passphrase: ssh-keygen -t ed25519 -C "you@yourpc"
  2. Install the public key on the server (Linux, macOS), then log in with it from a NEW terminal:
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server
ssh -o PreferredAuthentications=publickey user@server
  1. On the server, create /etc/ssh/sshd_config.d/00-keys-only.conf containing PasswordAuthentication no, KbdInteractiveAuthentication no and PermitRootLogin no.
  2. Validate, check the effective values, then reload (ssh on Debian/Ubuntu, sshd on RHEL/Fedora/Arch):
sudo sshd -t
sudo sshd -T | grep -Ei '^(passwordauth|kbdinteractive|permitroot)'
sudo systemctl reload ssh
  1. From a third terminal, confirm the key still works and a password is refused.

Keep your first working session open until step 5 passes. If it fails, fix it from that session. Know where the server console is before you start.

← Full article, with the diagnosis and the why

Was this helpful?

Updated on October 14, 2026