# SSH Password Authentication

> Logging in to SSH with a password. Safer servers turn it off and use keys.

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** PasswordAuthentication, SSH Password Login, Disable Password Login

## Think of it like

Think of it like a door that opens to anyone who says the right word. Someone will keep guessing words.

## Definition

Password authentication is logging in to SSH by typing a password. It is easy, but bots try common passwords on every server, all day long. A password can be guessed, reused or stolen. Most guides say to turn it off once your key works. You do that with PasswordAuthentication no in sshd_config.

## Example

Lucy's new server logs thousands of failed password guesses in its first day. She turns password login off, and the guesses stop working.

## Example code

```console
$ ssh -o PubkeyAuthentication=no lucy@203.0.113.10
lucy@203.0.113.10: Permission denied (publickey).
```

With passwords turned off, a login without a key is refused at once.

## Why it matters

Guessing passwords is the most common attack on a new server. Turning them off ends it.

## Common mistake

Turning it off before your key login works. Then nobody, including you, can get in.

## Three principles

- **Easy to guess.** Bots try all day.
- **Keys instead.** Turn passwords off once keys work.
- **One line.** PasswordAuthentication no.

## Related terms

- [SSH Public Key Authentication](https://learn.benibix.com/term/infrastructure/public-key-authentication)
- [sshd_config](https://learn.benibix.com/term/infrastructure/sshd-config)
- [Fail2ban](https://learn.benibix.com/term/infrastructure/fail2ban)
- [SSH Key Pair](https://learn.benibix.com/term/infrastructure/ssh-key-pair)

## Told apart from

- [SSH Key Passphrase vs SSH Password Login](https://learn.benibix.com/compare/ssh-key-passphrase-vs-ssh-password-authentication): People think a key passphrase is the same as a password login, and it is not. A password login sends a password to the server, and a bot can guess it there. A passphrase never leaves your laptop. It only unlocks your private key file, so a stolen copy of the file is no use.

## Taught in

- [sshd_config and Fail2ban](https://learn.benibix.com/learn/infrastructure-ssh/sshd-config-and-fail2ban): SSH, 6/9

![Bots on the left try many passwords against a server's SSH door. Inside the server, the file sshd_config has two switches turned off: password login and root login. A guard marked fail2ban reads the log, sees one address failing again and again, and bans it at the firewall. A laptop with a key gets in.](https://learn.benibix.com/diagrams/inf3-ssh-hardening.svg)

---

Source: https://learn.benibix.com/term/infrastructure/ssh-password-authentication
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
