1 1.30 riastrad # $NetBSD: sshd_config,v 1.31 2026/09/21 21:31:00 christos Exp $ 2 1.31 christos # $OpenBSD: sshd_config,v 1.106 2026/07/10 17:21:19 naddy Exp $ 3 1.1 christos 4 1.1 christos # This is the sshd server system-wide configuration file. See 5 1.1 christos # sshd_config(5) for more information. 6 1.1 christos 7 1.1 christos # The strategy used for options in the default sshd_config shipped with 8 1.1 christos # OpenSSH is to specify options with their default value where 9 1.8 christos # possible, but leave them commented. Uncommented options override the 10 1.1 christos # default value. 11 1.1 christos 12 1.1 christos #Port 22 13 1.1 christos #AddressFamily any 14 1.1 christos #ListenAddress 0.0.0.0 15 1.1 christos #ListenAddress :: 16 1.1 christos 17 1.1 christos #HostKey /etc/ssh/ssh_host_rsa_key 18 1.7 christos #HostKey /etc/ssh/ssh_host_ecdsa_key 19 1.12 christos #HostKey /etc/ssh/ssh_host_ed25519_key 20 1.31 christos #HostKey /etc/ssh/ssh_host_mldsa44_ed25519_key 21 1.1 christos 22 1.11 christos # Ciphers and keying 23 1.11 christos #RekeyLimit default none 24 1.11 christos 25 1.1 christos # Logging 26 1.1 christos #SyslogFacility AUTH 27 1.1 christos #LogLevel INFO 28 1.1 christos 29 1.1 christos # Authentication: 30 1.1 christos 31 1.19 christos # For slow CPUs, bumped from 2 minutes to 10 32 1.19 christos LoginGraceTime 600 33 1.15 christos #PermitRootLogin prohibit-password 34 1.1 christos #StrictModes yes 35 1.1 christos #MaxAuthTries 6 36 1.1 christos #MaxSessions 10 37 1.1 christos 38 1.1 christos #PubkeyAuthentication yes 39 1.8 christos 40 1.8 christos # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 41 1.8 christos # but this is overridden so installations will only check .ssh/authorized_keys 42 1.8 christos AuthorizedKeysFile .ssh/authorized_keys 43 1.1 christos 44 1.9 christos #AuthorizedPrincipalsFile none 45 1.9 christos 46 1.10 christos #AuthorizedKeysCommand none 47 1.10 christos #AuthorizedKeysCommandUser nobody 48 1.10 christos 49 1.1 christos # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts 50 1.1 christos #HostbasedAuthentication no 51 1.1 christos # Change to yes if you don't trust ~/.ssh/known_hosts for 52 1.18 christos # HostbasedAuthentication 53 1.1 christos #IgnoreUserKnownHosts no 54 1.1 christos # Don't read the user's ~/.rhosts and ~/.shosts files 55 1.1 christos #IgnoreRhosts yes 56 1.1 christos 57 1.30 riastrad # To disable password authentication, you must BOTH 58 1.30 riastrad # (a) set PasswordAuthentication to "no", AND 59 1.30 riastrad # (b) set KbdInteractiveAuthentication to "no", or set UsePAM to "no", 60 1.30 riastrad # or disable all password-based auth modules in /etc/pam.d/sshd. 61 1.30 riastrad # Alternatively, you can configure AuthenticationMethods with a 62 1.30 riastrad # specific list of methods excluding "password" and 63 1.30 riastrad # "keyboard-interactive". 64 1.1 christos #PasswordAuthentication yes 65 1.1 christos #PermitEmptyPasswords no 66 1.1 christos 67 1.29 christos # Change to "no" to disable keyboard-interactive authentication. Depending on 68 1.29 christos # the system's configuration, this may involve passwords, challenge-response, 69 1.29 christos # one-time passwords or some combination of these and other methods. 70 1.26 christos #KbdInteractiveAuthentication yes 71 1.1 christos 72 1.25 kim # Kerberos options 73 1.25 kim #KerberosAuthentication no 74 1.25 kim #KerberosOrLocalPasswd yes 75 1.25 kim #KerberosTicketCleanup yes 76 1.25 kim #KerberosGetAFSToken no 77 1.25 kim 78 1.25 kim # GSSAPI options 79 1.25 kim #GSSAPIAuthentication no 80 1.25 kim #GSSAPICleanupCredentials yes 81 1.25 kim 82 1.25 kim # Set this to 'yes' to enable PAM authentication, account processing, 83 1.25 kim # and session processing. If this is enabled, PAM authentication will 84 1.27 he # be allowed through the KbdInteractiveAuthentication and 85 1.27 he # PasswordAuthentication settings. Depending on your PAM configuration, 86 1.27 he # PAM authentication via KbdInteractiveAuthentication may bypass 87 1.25 kim # the setting of "PermitRootLogin without-password". 88 1.25 kim # If you just want the PAM account and session checks to run without 89 1.25 kim # PAM authentication, then enable this but set PasswordAuthentication 90 1.27 he # and KbdInteractiveAuthentication to 'no'. 91 1.25 kim UsePAM yes 92 1.25 kim 93 1.1 christos #AllowAgentForwarding yes 94 1.1 christos #AllowTcpForwarding yes 95 1.1 christos #GatewayPorts no 96 1.1 christos #X11Forwarding no 97 1.2 christos # If you use xorg from pkgsrc then uncomment the following line. 98 1.2 christos #XAuthLocation /usr/pkg/bin/xauth 99 1.1 christos #X11DisplayOffset 10 100 1.1 christos #X11UseLocalhost yes 101 1.12 christos #PermitTTY yes 102 1.1 christos #PrintMotd yes 103 1.1 christos #PrintLastLog yes 104 1.1 christos #TCPKeepAlive yes 105 1.1 christos #PermitUserEnvironment no 106 1.1 christos #Compression delayed 107 1.1 christos #ClientAliveInterval 0 108 1.1 christos #ClientAliveCountMax 3 109 1.13 christos #UseDNS no 110 1.1 christos #PidFile /var/run/sshd.pid 111 1.10 christos #MaxStartups 10:30:100 112 1.1 christos #PermitTunnel no 113 1.1 christos #ChrootDirectory none 114 1.9 christos #VersionAddendum none 115 1.1 christos 116 1.1 christos # no default banner path 117 1.1 christos #Banner none 118 1.1 christos 119 1.5 adam # here are the new patched ldap related tokens 120 1.5 adam # entries in your LDAP must have posixAccount & ldapPublicKey objectclass 121 1.5 adam #UseLPK yes 122 1.5 adam #LpkLdapConf /etc/ldap.conf 123 1.5 adam #LpkServers ldap://10.1.7.1/ ldap://10.1.7.2/ 124 1.5 adam #LpkUserDN ou=users,dc=phear,dc=org 125 1.5 adam #LpkGroupDN ou=groups,dc=phear,dc=org 126 1.5 adam #LpkBindDN cn=Manager,dc=phear,dc=org 127 1.5 adam #LpkBindPw secret 128 1.5 adam #LpkServerGroup mail 129 1.5 adam #LpkFilter (hostAccess=master.phear.org) 130 1.5 adam #LpkForceTLS no 131 1.5 adam #LpkSearchTimelimit 3 132 1.5 adam #LpkBindTimelimit 3 133 1.5 adam #LpkPubKeyAttr sshPublicKey 134 1.5 adam 135 1.1 christos # override default of no subsystems 136 1.1 christos Subsystem sftp /usr/libexec/sftp-server 137 1.1 christos 138 1.2 christos # the following are HPN related configuration options 139 1.2 christos # tcp receive buffer polling. disable in non autotuning kernels 140 1.2 christos #TcpRcvBufPoll yes 141 1.3 dyoung 142 1.2 christos # allow the use of the none cipher 143 1.2 christos #NoneEnabled no 144 1.2 christos 145 1.3 dyoung # disable hpn performance boosts. 146 1.28 nia HPNDisabled yes 147 1.2 christos 148 1.2 christos # buffer size for hpn to non-hpn connections 149 1.2 christos #HPNBufferSize 2048 150 1.2 christos 151 1.1 christos # Example of overriding settings on a per-user basis 152 1.1 christos #Match User anoncvs 153 1.1 christos # X11Forwarding no 154 1.1 christos # AllowTcpForwarding no 155 1.12 christos # PermitTTY no 156 1.1 christos # ForceCommand cvs server 157