您的位置:首页 > 其它

/etc/ssh/sshd_config

2017-08-18 01:14 525 查看
#	$OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $

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

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

# 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.

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22									##监听端口,为了安全起见,为安全起见建议默认端口22为 1025~65534之间端口
##从0~65535全部是标准端口,但是从0~1024号端口是系统端口,用户无法修改
##从1025~65534端口是系统为用户预留的端口,而65535号端口为系统保留
#AddressFamily any							##监听地址 有监听地址的话设置监听当前设置地址的ssh联机;any任意机器都能ssh联机
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2									## 协议版本

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key				##设置秘钥路径
# HostKeys for protocol version 2			##设置SSH version 2 使用的私钥
HostKey /etc/ssh/ssh_host_rsa_key   		##设置SSH version 2 使用的 RSA 私钥
#HostKey /etc/ssh/ssh_host_dsa_key			##设置SSH version 2 使用的 dsa 私钥
HostKey /etc/ssh/ssh_host_ecdsa_key			##设置SSH version 2 使用的 ecdsa 私钥
HostKey /etc/ssh/ssh_host_ed25519_key		##设置SSH version 2 使用的 ed25519 私钥

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h					##KeyRegenerationInterval用来设置多长时间后系统自动重新生成服务器的秘钥,
#ServerKeyBits 1024							##ServerKeyBits用来定义服务器密钥的长度

# Ciphers and keying
#RekeyLimit default none

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV						##SyslogFacility用来设定在记录来自sshd的消息的时候,是否给出“facility code”
#LogLevel INFO								##LogLevel用来设定sshd日志消息的级别

# Authentication:							##限制用户必须在指定的时限内认证成功,0 表示无限制。默认值是 120 秒。

#LoginGraceTime 2m							##LoginGraceTime用来设定如果用户登录失败,在切断连接前服务器需要等待的时间,单位为妙
#PermitRootLogin yes						##PermitRootLogin用来设置能不能直接以超级用户ssh登录,root远程登录Linux很危险,建议注销或设置为no
#StrictModes yes							##StrictModes用来设置ssh在接收登录请求之前是否检查用户根目录和rhosts文件的权限和所有权,建议开启
#MaxAuthTries 6
#MaxSessions 10

RSAAuthentication yes						##RSAAuthentication用来设置是否开启RSA密钥验证,只针对SSH1
PubkeyAuthentication yes					##PubkeyAuthentication用来设置是否开启公钥验证,如果使用公钥验证的方式登录时,则设置为yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys	##AuthorizedKeysFile用来设置公钥验证文件的路径,与PubkeyAuthentication配合使用,默认值是".ssh/authorized_keys"。

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no					##是否使用强可信主机认证(通过检查远程主机名和关联的用户名进行认证)。仅用于SSH-1。
# similar for protocol version 2
#HostbasedAuthentication no					##这个指令与 RhostsRSAAuthentication 类似,但是仅可以用于SSH-2。
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no  					##IgnoreUserKnownHosts用来设置ssh在进行RhostsRSAAuthentication安全验证时是否忽略用户的“/$HOME/.ssh/known_hosts”文件
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes							##IgnoreRhosts用来设置验证的时候是否使用“~/.rhosts”和“~/.shosts”文件

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes					##PasswordAuthentication用来设置是否开启密码验证机制,如果用密码登录系统,则设置yes
#PermitEmptyPasswords no					#PermitEmptyPasswords用来设置是否允许用口令为空的账号登录系统,设置no
PasswordAuthentication yes					##是否允许使用基于密码的认证。默认为"yes"。

# Change to no to disable s/key passwords   ##设置禁用s/key密码
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no			##ChallengeResponseAuthentication 是否允许质疑-应答(challenge-response)认证

########3.3、与 Kerberos 有关的参数设定,指定是否允许基于Kerberos的用户认证########
# Kerberos options
#KerberosAuthentication no					##是否要求用户为PasswdAuthentication提供的密码必须通过Kerberos KDC认证,要使用Kerberos认证,
###服务器必须提供一个可以校验KDC identity的Kerberos servtab。默认值为n
#KerberosOrLocalPasswd yes					##如果Kerberos密码认证失败,那么该密码还将要通过其他的的认证机制,如/etc/passwd
###在启用此项后,如果无法通过Kerberos验证,则密码的正确性将由本地的机制来决定,如/etc/passwd,默认为yes
#KerberosTicketCleanup yes					##设置是否在用户退出登录是自动销毁用户的ticket
#KerberosGetAFSToken no						##如果使用AFS并且该用户有一个Kerberos 5 TGT,那么开启该指令后,
###将会在访问用户的家目录前尝试获取一个AFS token,并尝试传送 AFS token 给 Server 端,默认为n
#KerberosUseKuserok yes

####3.4、与 GSSAPI 有关的参数设定,指定是否允许基于GSSAPI的用户认证,仅适用于SSH2####
# GSSAPI options							##GSSAPI 是一套类似 Kerberos 5 的通用网络安全系统接口。
GSSAPIAuthentication yes					##GSSAPIAuthentication 指定是否允许基于GSSAPI的用户认证,默认为no
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes				##GSSAPICleanupCredentials 设置是否在用户退出登录是自动销毁用户的凭证缓存
#GSSAPIKeyExchange no
#GSSAPIEnablek5users 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'.
# WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
# problems.

#将此设置为“是”以启用PAM身份验证,帐户处理,和会话处理。 如果启用,PAM认证将会
#允许通过ChallengeResponseAuthentication和PasswordAuthentication。 根据您的PAM配置,
#通过ChallengeResponse认证的PAM认证可能会绕过“PermitRootLogin without-password”的设置。
#如果您只想要PAM帐户和会话检查运行没有PAM认证,然后启用,但设置PasswordAuthentication和ChallengeResponseAuthentication为'否'。
#警告:Red Hat Enterprise Linux不支持“UsePAM no”,可能会导致几个问题。

UsePAM yes									##设置是否通过PAM验证

#AllowAgentForwarding yes
#AllowTcpForwarding yes						##AllowTcpForwarding设置是否允许允许tcp端口转发,保护其他的tcp连接
#GatewayPorts no							##GatewayPorts 设置是否允许远程客户端使用本地主机的端口转发功能,出于安全考虑,建议禁止
X11Forwarding yes							##X11Forwarding 用来设置是否允许X11转发
#X11DisplayOffset 10						##指定X11 转发的第一个可用的显示区(display)数字。默认值是 10 。
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes								##PrintMotd用来设置sshd是否在用户登录时显示“/etc/motd”中的信息,可以选在在“/etc/motd”中加入警告的信息
#PrintLastLog yes							##PrintLastLog 是否显示上次登录信息
#TCPKeepAlive yes							##TCPKeepAlive 是否持续连接,设置yes可以防止死连接
#UseLogin no								##UseLogin 设置是否在交互式会话的登录过程中使用。默认值是"no"
UsePrivilegeSeparation sandbox				##UsePrivilegeSeparation 设置使用者的权限
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes									##UseDNS是否使用dns反向解析
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100						#MaxStartups 设置同时允许几个尚未登入的联机,当用户连上ssh但并未输入密码即为所谓的联机,
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Accept locale-related environment variables		##AcceptEnv 指定客户端发送的哪些环境变量将会被传递到会话环境中。
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

# override default of no subsystems			##关于 SFTP 服务的设定项目
Subsystem	sftp	/usr/libexec/openssh/sftp-server

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



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: