pavement

Sshd config

From FreeBSDwiki
Revision as of 15:30, 24 May 2011 by 83.248.177.186 (Talk)
Jump to: navigation, search

Whenever you edit sshd_config, you'll want to restart sshd: /etc/rc.d/sshd restart

Example sshd_config file, from a newly installed 8.2-RELEASE system:

  1. $OpenBSD: sshd_config,v 1.81 2009/10/08 14:03:41 markus Exp $
  2. $FreeBSD: src/crypto/openssh/sshd_config,v 1.49.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $
  1. This is the sshd server system-wide configuration file. See
  2. sshd_config(5) for more information.
  1. This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
  1. The strategy used for options in the default sshd_config shipped with
  2. OpenSSH is to specify options with their default value where
  3. possible, but leave them commented. Uncommented options change a
  4. default value.
  1. Note that some of FreeBSD's defaults differ from OpenBSD's, and
  2. FreeBSD has a few additional options.
  1. VersionAddendum FreeBSD-20100308
  1. Port 22
  2. AddressFamily any
  3. ListenAddress 0.0.0.0
  4. ListenAddress ::
  1. The default requires explicit activation of protocol 1
  2. Protocol 2
  1. HostKey for protocol version 1
  2. HostKey /etc/ssh/ssh_host_key
  3. HostKeys for protocol version 2
  4. HostKey /etc/ssh/ssh_host_rsa_key
  5. HostKey /etc/ssh/ssh_host_dsa_key
  1. Lifetime and size of ephemeral version 1 server key
  2. KeyRegenerationInterval 1h
  3. ServerKeyBits 1024
  1. Logging
  2. obsoletes QuietMode and FascistLogging
  3. SyslogFacility AUTH
  4. LogLevel INFO
  1. Authentication:
  1. LoginGraceTime 2m
  2. PermitRootLogin no
  3. StrictModes yes
  4. MaxAuthTries 6
  5. MaxSessions 10
  1. RSAAuthentication yes
  2. PubkeyAuthentication yes
  3. AuthorizedKeysFile .ssh/authorized_keys
  1. For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  2. RhostsRSAAuthentication no
  3. similar for protocol version 2
  4. HostbasedAuthentication no
  5. Change to yes if you don't trust ~/.ssh/known_hosts for
  6. RhostsRSAAuthentication and HostbasedAuthentication
  7. IgnoreUserKnownHosts no
  8. Don't read the user's ~/.rhosts and ~/.shosts files
  9. IgnoreRhosts yes
  1. Change to yes to enable built-in password authentication.
  2. PasswordAuthentication no
  3. PermitEmptyPasswords no
  1. Change to no to disable PAM authentication
  2. ChallengeResponseAuthentication yes
  1. Kerberos options
  2. KerberosAuthentication no
  3. KerberosOrLocalPasswd yes
  4. KerberosTicketCleanup yes
  5. KerberosGetAFSToken no
  1. GSSAPI options
  2. GSSAPIAuthentication no
  3. GSSAPICleanupCredentials yes
  1. Set this to 'no' to disable PAM authentication, account processing,
  2. and session processing. If this is enabled, PAM authentication will
  3. be allowed through the ChallengeResponseAuthentication and
  4. PasswordAuthentication. Depending on your PAM configuration,
  5. PAM authentication via ChallengeResponseAuthentication may bypass
  6. the setting of "PermitRootLogin without-password".
  7. If you just want the PAM account and session checks to run without
  8. PAM authentication, then enable this but set PasswordAuthentication
  9. and ChallengeResponseAuthentication to 'no'.
  10. UsePAM yes
  1. AllowAgentForwarding yes
  2. AllowTcpForwarding yes
  3. GatewayPorts no
  4. X11Forwarding yes
  5. X11DisplayOffset 10
  6. X11UseLocalhost yes
  7. PrintMotd yes
  8. PrintLastLog yes
  9. TCPKeepAlive yes
  10. UseLogin no
  11. UsePrivilegeSeparation yes
  12. PermitUserEnvironment no
  13. Compression delayed
  14. ClientAliveInterval 0
  15. ClientAliveCountMax 3
  16. UseDNS yes
  17. PidFile /var/run/sshd.pid
  18. MaxStartups 10
  19. PermitTunnel no
  20. ChrootDirectory none
  1. no default banner path
  2. Banner none
  1. override default of no subsystems

Subsystem sftp /usr/libexec/sftp-server

  1. Example of overriding settings on a per-user basis
  2. Match User anoncvs
  3. X11Forwarding no
  4. AllowTcpForwarding no
  5. ForceCommand cvs server
Personal tools