1. # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
    2. # This is the sshd server system-wide configuration file. See
    3. # sshd_config(5) for more information.
    4. # This sshd was compiled with PATH=/usr/local/bin:/usr/bin
    5. # The strategy used for options in the default sshd_config shipped with
    6. # OpenSSH is to specify options with their default value where
    7. # possible, but leave them commented. Uncommented options override the
    8. # default value.
    9. # If you want to change the port on a SELinux system, you have to tell
    10. # SELinux about this change.
    11. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
    12. #
    13. #Port 22
    14. #AddressFamily any
    15. #ListenAddress 0.0.0.0
    16. #ListenAddress ::
    17. HostKey /etc/ssh/ssh_host_rsa_key
    18. #HostKey /etc/ssh/ssh_host_dsa_key
    19. HostKey /etc/ssh/ssh_host_ecdsa_key
    20. HostKey /etc/ssh/ssh_host_ed25519_key
    21. # Ciphers and keying
    22. #RekeyLimit default none
    23. # Logging
    24. #SyslogFacility AUTH
    25. SyslogFacility AUTHPRIV
    26. #LogLevel INFO
    27. # Authentication:
    28. #LoginGraceTime 2m
    29. #PermitRootLogin yes
    30. #StrictModes yes
    31. #MaxAuthTries 6
    32. #MaxSessions 10
    33. #PubkeyAuthentication yes
    34. # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
    35. # but this is overridden so installations will only check .ssh/authorized_keys
    36. AuthorizedKeysFile .ssh/authorized_keys
    37. #AuthorizedPrincipalsFile none
    38. #AuthorizedKeysCommand none
    39. #AuthorizedKeysCommandUser nobody
    40. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
    41. #HostbasedAuthentication no
    42. # Change to yes if you don't trust ~/.ssh/known_hosts for
    43. # HostbasedAuthentication
    44. #IgnoreUserKnownHosts no
    45. # Don't read the user's ~/.rhosts and ~/.shosts files
    46. #IgnoreRhosts yes
    47. # To disable tunneled clear text passwords, change to no here!
    48. #PasswordAuthentication yes
    49. #PermitEmptyPasswords no
    50. PasswordAuthentication yes
    51. # Change to no to disable s/key passwords
    52. #ChallengeResponseAuthentication yes
    53. ChallengeResponseAuthentication no
    54. # Kerberos options
    55. #KerberosAuthentication no
    56. #KerberosOrLocalPasswd yes
    57. #KerberosTicketCleanup yes
    58. #KerberosGetAFSToken no
    59. #KerberosUseKuserok yes
    60. # GSSAPI options
    61. GSSAPIAuthentication yes
    62. GSSAPICleanupCredentials no
    63. #GSSAPIStrictAcceptorCheck yes
    64. #GSSAPIKeyExchange no
    65. #GSSAPIEnablek5users no
    66. # Set this to 'yes' to enable PAM authentication, account processing,
    67. # and session processing. If this is enabled, PAM authentication will
    68. # be allowed through the ChallengeResponseAuthentication and
    69. # PasswordAuthentication. Depending on your PAM configuration,
    70. # PAM authentication via ChallengeResponseAuthentication may bypass
    71. # the setting of "PermitRootLogin without-password".
    72. # If you just want the PAM account and session checks to run without
    73. # PAM authentication, then enable this but set PasswordAuthentication
    74. # and ChallengeResponseAuthentication to 'no'.
    75. # WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
    76. # problems.
    77. UsePAM yes
    78. #AllowAgentForwarding yes
    79. #AllowTcpForwarding yes
    80. #GatewayPorts no
    81. X11Forwarding yes
    82. #X11DisplayOffset 10
    83. #X11UseLocalhost yes
    84. #PermitTTY yes
    85. #PrintMotd yes
    86. #PrintLastLog yes
    87. #TCPKeepAlive yes
    88. #UseLogin no
    89. #UsePrivilegeSeparation sandbox
    90. #PermitUserEnvironment no
    91. #Compression delayed
    92. #ClientAliveInterval 0
    93. #ClientAliveCountMax 3
    94. #ShowPatchLevel no
    95. #UseDNS yes
    96. #PidFile /var/run/sshd.pid
    97. #MaxStartups 10:30:100
    98. #PermitTunnel no
    99. #ChrootDirectory none
    100. #VersionAddendum none
    101. # no default banner path
    102. #Banner none
    103. # Accept locale-related environment variables
    104. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    105. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    106. AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    107. AcceptEnv XMODIFIERS
    108. # override default of no subsystems
    109. Subsystem sftp /usr/libexec/openssh/sftp-server
    110. # Example of overriding settings on a per-user basis
    111. #Match User anoncvs
    112. # X11Forwarding no
    113. # AllowTcpForwarding no
    114. # PermitTTY no
    115. # ForceCommand cvs server

    去掉注释和空格后

    1. cat /etc/ssh/sshd_config | grep -v '^#' | grep -v '^$'
    1. HostKey /etc/ssh/ssh_host_rsa_key
    2. HostKey /etc/ssh/ssh_host_ecdsa_key
    3. HostKey /etc/ssh/ssh_host_ed25519_key
    4. SyslogFacility AUTHPRIV
    5. AuthorizedKeysFile .ssh/authorized_keys
    6. PasswordAuthentication yes
    7. ChallengeResponseAuthentication no
    8. GSSAPIAuthentication yes
    9. GSSAPICleanupCredentials no
    10. UsePAM yes
    11. X11Forwarding yes
    12. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    13. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    14. AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    15. AcceptEnv XMODIFIERS
    16. Subsystem sftp /usr/libexec/openssh/sftp-server
    1. HostKey /etc/ssh/ssh_host_rsa_key
    2. HostKey /etc/ssh/ssh_host_ecdsa_key
    3. HostKey /etc/ssh/ssh_host_ed25519_key
    4. SyslogFacility AUTHPRIV
    5. AuthorizedKeysFile .ssh/authorized_keys
    6. ChallengeResponseAuthentication no
    7. GSSAPIAuthentication yes
    8. GSSAPICleanupCredentials no
    9. UsePAM yes
    10. X11Forwarding yes
    11. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    12. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    13. AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    14. AcceptEnv XMODIFIERS
    15. Subsystem sftp /usr/libexec/openssh/sftp-server
    16. #禁用密码验证
    17. PasswordAuthentication no
    18. #启用密钥验证
    19. PubkeyAuthentication yes