Linux

Where Is the OpenSSH Server Config?

Main OpenSSH server configuration file and drop in directory on Linux.

Last updated

sshd reads /etc/ssh/sshd_config at startup, plus drop in files on distributions that enable Include. The first value set for each keyword wins.

Editing requires root. A syntax error can block remote access, so validate before restart when connected remotely.

Where OpenSSH Server stores this, by platform

Linux
/etc/ssh/sshd_config

Main sshd config, keyword and argument pairs with # for comments. Should be writable by root only. On Debian, Ubuntu, and recent upstream builds, /etc/ssh/sshd_config.d/*.conf is included at the top, so drop in values override the main file. Custom port, auth, and Subsystem sftp paths are common entries here.

Frequently asked questions

How do I test sshd_config safely?

Run sshd -t for syntax check and sshd -T for effective config as root. Keep the current SSH session open while restarting sshd, then open a second session to confirm access.

Why does my sshd_config change have no effect?

A drop in file under /etc/ssh/sshd_config.d may set the option earlier and take precedence because first value wins. Also confirm the service was reloaded and that the correct file is used (check sshd -f path or systemd unit).

Notice an outdated path? Let us know.