# sshd_config

> The settings file for the SSH server. It decides who may log in and how.

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** /etc/ssh/sshd_config, SSH Server Config, PermitRootLogin

## Think of it like

Think of it like the rule sheet on the doorman's desk. It says who may come in and how.

## Definition

sshd_config is the settings file for the SSH server. It lives at /etc/ssh/sshd_config. Each line turns one rule on or off, like whether root may log in. Changes only count after you reload the SSH service. A mistake here can lock everyone out, so test before you log out.

## Example

Jack sets PermitRootLogin to no and reloads SSH. Now nobody can log in straight to root, even with the right key.

## Example code

```console
$ grep -E '^(PermitRootLogin|PasswordAuthentication)' /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
$ sudo systemctl reload ssh
```

Two lines that close the doors most attacks try. Then reload so they take effect.

## Why it matters

A few lines here decide how hard the server is to break into.

## Common mistake

Editing it and closing the last open session before testing. If a line is wrong, you are locked out.

## Three principles

- **Server side.** Lives in /etc/ssh.
- **Reload to apply.** Edits do nothing until then.
- **Test first.** Keep one session open.

## Related terms

- [SSH Server (sshd)](https://learn.benibix.com/term/infrastructure/ssh-server)
- [SSH Password Authentication](https://learn.benibix.com/term/infrastructure/ssh-password-authentication)
- [Fail2ban](https://learn.benibix.com/term/infrastructure/fail2ban)
- [SSH Config File (~/.ssh/config)](https://learn.benibix.com/term/infrastructure/ssh-config-file)
- [Root User](https://learn.benibix.com/term/infrastructure/root-user)

## Told apart from

- [SSH Config File vs sshd_config](https://learn.benibix.com/compare/ssh-config-file-vs-sshd-config): People often think these are one file, because the names are so close. ~/.ssh/config lives on your own computer and sets up how you log in. sshd_config lives on the server and sets the rules for who may log in. Editing the wrong one changes nothing you meant to change.

## 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/sshd-config
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.
