C.W.K.
Stream
Lesson 01 of 14 · published

Disable Password Authentication

~12 min · sshd, passwordauth, kbdinteractive, lockout

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

The single biggest security win

Once every device on your fleet has SSH keys installed (Track 2), turn off password authentication entirely on every server. This eliminates brute-force attacks at the protocol level — there's nothing for an attacker to guess. Move from "strong password and hope" to "key-only and laugh at the auth log."

What to set in sshd_config

Three directives, one restart, done. PasswordAuthentication no turns off plain passwords. KbdInteractiveAuthentication no turns off the legacy keyboard-interactive flow that was historically used to backdoor password auth. PubkeyAuthentication yes ensures key auth is explicitly on.

Code

sshd_config — disable password auth·bash
# Edit
sudo nano /etc/ssh/sshd_config

# Set:
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes

# Validate before restarting
sudo sshd -t

# Restart (Linux)
sudo systemctl restart sshd

# macOS — toggle Remote Login off/on in System Settings
Test before trusting·bash
# From a NEW terminal (keep the existing one open as lifeline)
ssh user@host
# Should authenticate via key, no password prompt

# Force a password attempt — should fail cleanly
ssh -o PreferredAuthentications=password \
    -o PubkeyAuthentication=no \
    user@host
# Expected: Permission denied (publickey).

External links

Exercise

On one server you control, edit sshd_config to disable password auth. Open a second terminal first with an active SSH session. Validate (sudo sshd -t), restart, then test from a new terminal. Confirm ssh -o PreferredAuthentications=password is rejected. The auth log on a public server should now be quiet of brute-force noise within 24 hours.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.