OpenSSH /etc/ssh/sshd_config

Authentic ๐Ÿ“‹ Debian 9 (Stretch) 124 lines

File Info

Size
124 lines
MD5
bbad7ed242a834e831c7066901cee49e
SHA256
8431c6f565a1a13e95982597051796c564d265706cbce797e33ac223ef136383

Quick Commands

curl:
curl https://exampleconfig.com/api/v1/config/original/bbad7ed242a834e831c7066901cee49e?hint=sshd_config
wget:
wget -O sshd_config https://exampleconfig.com/api/v1/config/original/bbad7ed242a834e831c7066901cee49e?hint=sshd_config
/etc/ssh/sshd_config
#	$OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile	.ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem	sftp	/usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server

How to Install OpenSSH

Alpine Linux

sudo apk add openssh-server

Debian

sudo apt update && sudo apt install openssh-server

Red Hat Enterprise Linux

sudo yum install openssh-server

Ubuntu

sudo apt update && sudo apt install openssh-server

Configuration File Location

File Path
/etc/ssh/sshd_config
Directory
/etc/ssh/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

Complete OpenSSH Configuration Guide

What is sshd_config?
Get the original 'sshd_config' (sshd_config) configuration file from a fresh OpenSSH installation on Debian 9 (Stretch). This is the factory-default SSH server configuration, crucial for security hardening, remote access troubleshooting, and understanding baseline security settings.
Technical Details
Located at '/etc/ssh/sshd_config', this 124-line file controls authentication methods, encryption algorithms, key exchange protocols, and access controls. Secures millions of servers worldwide and is the foundation for secure remote administration, file transfers, and automated deployments.
Common Configuration Question
How do you configure OpenSSH for maximum security, key-based authentication, and compliance on Debian 9?
Why Use This Configuration?
This default configuration includes modern cipher suites, authentication controls, and security best practices. Essential for security professionals, system administrators, and DevOps engineers managing secure remote access to production systems.

Frequently Asked Questions

When should I use this sshd_config file?

Use this original configuration file when you need to restore OpenSSH to its default state after misconfiguration, during fresh installations, or as a baseline for customization. It's particularly useful for troubleshooting when your current config isn't working properly.

How do I restore OpenSSH to default settings?

Download this file and replace your current configuration at /etc/ssh/sshd_config. Make sure to backup your existing configuration first, then restart the OpenSSH service to apply the changes.

Is this sshd_config file secure for production use?

This is the factory-default configuration that ships with OpenSSH on Debian 9 (Stretch). While it provides a secure baseline, you should review and customize security settings based on your specific production requirements and compliance needs.

What's the difference between this and other OS versions?

This configuration is specifically from Debian 9 (Stretch). Different operating systems and versions may have slightly different default settings, security patches, or feature availability. Check the compatibility section above for other OS versions.

Can I use this configuration file for OpenSSH troubleshooting?

Yes, this original configuration is excellent for troubleshooting. Compare it with your current settings to identify modifications that might be causing issues, or temporarily replace your config with this one to isolate problems.