首页 > 技术文章 > sshd_config注释

someone9 2018-03-28 00:03 原文

  1 [root@H0f ~]# cat /etc/ssh/sshd_config
  2 #update by H0f 2018-03-13
  3 #    $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
  4 
  5 # This is the sshd server system-wide configuration file.  See
  6 # sshd_config(5) for more information.
  7 
  8 # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
  9 
 10 # The strategy used for options in the default sshd_config shipped with
 11 # OpenSSH is to specify options with their default value where
 12 # possible, but leave them commented.  Uncommented options change a
 13 # default value.
 14 
 15 #Port 22           #ssh预设端口
 16 #AddressFamily any
 17 #ListenAddress 0.0.0.0  # 监听的主机适配卡
 18 #ListenAddress ::       ## 监听所有的SSH联机
 19 
 20 # Disable legacy (protocol version 1) support in the server for new
 21 # installations. In future the default will change to require explicit
 22 # activation of protocol 1
 23 Protocol 2     # 选择的 SSH 协议版本
 24 
 25 # HostKey for protocol version 1   # SSH version 1  
 26 #HostKey /etc/ssh/ssh_host_key    # SSH version 1 使用的私钥 
 27 # HostKeys for protocol version 2 # SSH version 2
 28 #HostKey /etc/ssh/ssh_host_rsa_key# SSH version 2 使用的 RSA 私钥 
 29 #HostKey /etc/ssh/ssh_host_dsa_key #SSH version 2 使用的 DSA 私钥  
 30 
 31 # Lifetime and size of ephemeral version 1 server key
 32 #KeyRegenerationInterval 1h  #key建立时间
 33 #ServerKeyBits 1024          # Server key 的长度
 34 
 35 # Logging
 36 # obsoletes QuietMode and FascistLogging
 37 #SyslogFacility AUTH
 38 SyslogFacility AUTHPRIV    #指定 sshd(8) 将日志消息通过哪个日志子系统(facility)发送
 39 #LogLevel INFO               #登录记录的等级
 40 
 41 # Authentication:
 42 
 43 #LoginGraceTime 2m        #限制用户必须在指定的时限内认证成功
 44 #PermitRootLogin yes      #允许root用户远程登录
 45 #StrictModes yes          #指定是否要求 sshd(8) 在接受连接请求前对用户主目录和相关的配置文件进行宿主和权限检查。
 46 #MaxAuthTries 6           #指定每个连接最大允许的认证次数。默认值是 6 
 47 #MaxSessions 10           #最大允许保持多少个未认证的连接。默认值是 10 
 48 
 49 #RSAAuthentication yes    #是否允许使用纯 RSA 公钥认证。仅用于SSH-1。默认值是"yes"
 50 RSAAuthentication no
 51 #PubkeyAuthentication yes #是否允许公钥认证。仅可以用于SSH-2。默认值为"yes" 52 PubkeyAuthentication no
 53 #AuthorizedKeysFile    .ssh/authorized_keys #存放该用户可以用来登录的 RSA/DSA 公钥。
 54 #AuthorizedKeysCommand none              #是否允许authorized_keys中使用command项
 55 #AuthorizedKeysCommandRunAs nobody       #限制能够在authorized_keys中使用command项的用户
 56 
 57 # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts 
 58              #是否开启基于rhosts的主机RSA算法认证,密钥存放于/etc/ssh/ssh_known_hosts
 59 #RhostsRSAAuthentication no              #是否开启基于主机的密钥认证
 60 # similar for protocol version 2
 61 #HostbasedAuthentication no              #是否开启基于主机的密钥认证
 62 # Change to yes if you don't trust ~/.ssh/known_hosts for
 63 # RhostsRSAAuthentication and HostbasedAuthentication
 64 #IgnoreUserKnownHosts no                 #设置是否忽略主机用户识别,前提是/.ssh/kown_hosts是否可信
 65 # Don't read the user's ~/.rhosts and ~/.shosts files
 66 #IgnoreRhosts yes                        #不查询用户主目录下的/.rhosts和/.shosts文件
 67 
 68 # To disable tunneled clear text passwords, change to no here!
 69 #PasswordAuthentication yes   #是否允许使用基于密码的认证
 70 #PermitEmptyPasswords no      #是否允许密码为空的用户远程登录
 71 PasswordAuthentication yes
 72 
 73 # Change to no to disable s/key passwords
 74 #ChallengeResponseAuthentication yes
 75 ChallengeResponseAuthentication no  #不开启质疑-应答认证
 76 
 77 # Kerberos options               #要使用Kerberos认证,服务器需要一个可以校验 KDC identity 的 Kerberos servtab 。
 78 #KerberosAuthentication no       #是否允许使用基于 Kerberos的用户认证。默认值为”no”。仅用于SSH-2
 79 #KerberosOrLocalPasswd yes       #如果 Kerberos 密码认证失败,那么该密码还将要通过其它的认证机制(比如 /etc/passwd)。默认值为”yes”。
 80 #KerberosTicketCleanup yes       #是否在用户退出登录后自动销毁用户的 ticket 。默认值是”yes”
 81 #KerberosGetAFSToken no          #如果使用了 AFS 并且该用户有一个 Kerberos 5 TGT,那么开启该指令后,
 82                                   将会在访问用户的家目录前尝试获取一个 AFS token 。默认为”no”
 83 #KerberosUseKuserok yes
 84 
 85 # GSSAPI options
 86 #GSSAPIAuthentication no         #是否允许使用基于 GSSAPI 的用户认证。默认值为”no”。仅用于SSH-2 87 #GSSAPIAuthentication no
 88 #GSSAPICleanupCredentials yes    #是否在用户退出登录后自动销毁用户凭证缓存。默认值是”yes”
 89 GSSAPICleanupCredentials yes
 90 #GSSAPIStrictAcceptorCheck yes   #是否对接收到的用户凭证严格校验
 91 #GSSAPIKeyExchange no            #是否开启密钥交换
 92 
 93 # Set this to 'yes' to enable PAM authentication, account processing, 
 94 # and session processing. If this is enabled, PAM authentication will 
 95 # be allowed through the ChallengeResponseAuthentication and
 96 # PasswordAuthentication.  Depending on your PAM configuration,
 97 # PAM authentication via ChallengeResponseAuthentication may bypass
 98 # the setting of "PermitRootLogin without-password".
 99 # If you just want the PAM account and session checks to run without
100 # PAM authentication, then enable this but set PasswordAuthentication
101 # and ChallengeResponseAuthentication to 'no'.
102 #UsePAM no
103 UsePAM yes    #启用pam认证
104 
105 # Accept locale-related environment variables
106 AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
107 AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
108 AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
109 AcceptEnv XMODIFIERS
110 
111 #AllowAgentForwarding yes
112 #AllowTcpForwarding yes  #允许TCP转发
113 #GatewayPorts no         #转发路径端口
114 #X11Forwarding no        #是否允许进行 X11 转发。默认值是"no",设为"yes"表示允许
115 X11Forwarding yes
116 #X11DisplayOffset 10     #指定 sshd(8) X11 转发的第一个可用的显示区(display)数字。默认值是 10 
117 #X11UseLocalhost yes     #否应当将X11转发服务器绑定到本地loopback地址。默认值是"yes"
118 #PrintMotd yes           #设置登录后是否显示/etc/motd文件中的信息
119 #PrintLastLog yes        #设置登录后是否显示上一次登录时间
120 #TCPKeepAlive yes        #keepalive检测
121 #UseLogin no             #是否在交互式登录时启用login
122 #UsePrivilegeSeparation yes #是否让 sshd(8)通过创建非特权子进程处理接入请求的方法来进行权限分离 默认值是”yes
123 #PermitUserEnvironment no   #指定是否允许 sshd(8) 处理 ~/.ssh/environment 以及~/.ssh/authorized_keys 中的 environment= 选项。默认值是”no”。
124 #Compression delayed        #是否对通信数据进行加密,还是延迟到认证成功之后再对通信数据加密 可用值:”yes” “delayed”(默认) “no”
125 #ClientAliveInterval 0      #设置空闲登录的最大时长
126 #ClientAliveCountMax 3      #在没收到任何数据的时候,最多向3个客户端进行keepalive检测
127 #ShowPatchLevel no          #显示补丁级别
128 #UseDNS yes                 #开启域名解析
129 #PidFile /var/run/sshd.pid  #存放守护进程的默认文件
130 #MaxStartups 10:30:100      #最大可以保持多少个未认证的连接
131 #PermitTunnel no            #允许tun设备转发
132 #ChrootDirectory none       #是否允许切换目录
133 
134 # no default banner path
135 #Banner none                #不设置欢迎词
136 
137 # override default of no subsystems
138 Subsystem    sftp    /usr/libexec/openssh/sftp-server
139 
140 # Example of overriding settings on a per-user basis
141 #Match User anoncvs
142 #    X11Forwarding no        #开启X11转发
143 #    AllowTcpForwarding no   # 是否允许TCP转发,默认值为"yes"144 #    ForceCommand cvs server #限制命令

 

推荐阅读