SSH服务器端/etc/ssh/sshd_conf配置文件详解

  • #Port 22 监听端口,默认监听22端口 【默认可修改】
  • #AddressFamily any IPV4和IPV6协议家族用哪个,any表示二者均有
  • #ListenAddress 0.0.0.0 指明监控的地址,0.0.0.0表示本机的所有地址 【默认可修改】
  • #ListenAddress :: 指明监听的IPV6的所有地址格式
  • The default requires explicit activation of protocol 1

  • #Protocol 2 使用SSH第二版本,centos7默认第一版本已拒绝
  • HostKey for protocol version 1 一版的SSH支持以下一种秘钥形式

  • #HostKey /etc/ssh/ssh_host_key
  • HostKeys for protocol version 2 使用第二版本发送秘钥,支持以下四种秘钥认证的存放位置:(centos6只支持rsa和dsa两种)

  • HostKey /etc/ssh/ssh_host_rsa_key rsa私钥认证 【默认】
  • #HostKey /etc/ssh/ssh_host_dsa_key dsa私钥认证
  • HostKey /etc/ssh/ssh_host_ecdsa_key ecdsa私钥认证
  • HostKey /etc/ssh/ssh_host_ed25519_key ed25519私钥认证
  • Lifetime and size of ephemeral version 1 server key

  • #KeyRegenerationInterval 1h
  • #ServerKeyBits 1024 主机秘钥长度
  • Ciphers and keying

  • #RekeyLimit default none
  • Logging

  • obsoletes QuietMode and FascistLogging

  • #SyslogFacility AUTH
  • SyslogFacility AUTHPRIV 当有人使用ssh登录系统的时候,SSH会记录信息,信息保存在/var/log/secure里面
  • #LogLevel INFO 日志的等级
  • Authentication:

  • #LoginGraceTime 2m 登录的宽限时间,默认2分钟没有输入密码,则自动断开连接
  • #PermitRootLogin no
  • PermitRootLogin yes 是否允许管理员直接登录,‘yes‘表示允许
  • #StrictModes yes 是否让sshd去检查用户主目录或相关文件的权限数据
  • #MaxAuthTries 6 最大认证尝试次数,最多可以尝试6次输入密码。之后需要等待某段时间后才能再次输入密码
  • #MaxSessions 10 允许的最大会话数
  • #RSAAuthentication 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 服务器生成一对公私钥之后,会将公钥放到.ssh/authorizd_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
  • similar for protocol version 2

  • #HostbasedAuthentication no
  • Change to yes if you don‘t trust ~/.ssh/known_hosts for

  • RhostsRSAAuthentication and HostbasedAuthentication

  • #IgnoreUserKnownHosts no
  • Don‘t read the user‘s ~/.rhosts and ~/.shosts files

  • #IgnoreRhosts yes
  • To disable tunneled clear text passwords, change to no here!

  • #PasswordAuthentication yes
  • #PermitEmptyPasswords no
  • PasswordAuthentication yes 是否允许支持基于口令的认证
  • Change to no to disable s/key passwords

  • #ChallengeResponseAuthentication yes
  • ChallengeResponseAuthentication no 是否允许任何的密码认证
  • Kerberos options 是否支持kerberos(基于第三方的认证,如LDAP)认证的方式,默认为no

  • #KerberosAuthentication no
  • #KerberosOrLocalPasswd yes
  • #KerberosTicketCleanup yes
  • #KerberosGetAFSToken no
  • #KerberosUseKuserok yes
  • GSSAPI options

  • GSSAPIAuthentication yes
  • GSSAPICleanupCredentials no
  • #GSSAPIStrictAcceptorCheck yes
  • #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.

  • UsePAM yes
  • #AllowAgentForwarding yes
  • #AllowTcpForwarding yes
  • #GatewayPorts no
  • X11Forwarding yes 是否允许x11转发,可以让窗口的数据通过SSH连接来传递(请查看ssh -X 参数):#ssh -X [email protected]
  • #X11DisplayOffset 10
  • #X11UseLocalhost yes
  • #PermitTTY yes
  • #PrintMotd yes
  • #PrintLastLog yes
  • #TCPKeepAlive yes
  • #UseLogin no
  • UsePrivilegeSeparation sandbox # Default for new installations.
  • #PermitUserEnvironment no
  • #Compression delayed
  • #ClientAliveInterval 0
  • #ClientAliveCountMax 3
  • #ShowPatchLevel no
  • #UseDNS yes 是否反解DNS,如果想让客户端连接服务器端快一些,这个可以改为no
  • #PidFile /var/run/sshd.pid
  • #MaxStartups 10:30:100
  • #PermitTunnel no
  • #ChrootDirectory none
  • #VersionAddendum none
  • no default banner path

  • #Banner none
  • Accept locale-related environment variables

  • 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

  • Subsystem sftp /usr/libexec/openssh/sftp-server 支持 SFTP ,如果注释掉,则不支持sftp连接
  • Example of overriding settings on a per-user basis

  • #Match User anoncvs
  • X11Forwarding no

  • AllowTcpForwarding no

  • PermitTTY no

  • ForceCommand cvs server

  • AllowUsers user1 user2 登录白名单(默认没有这个配置,需要自己手动添加),允许远程登录的用户。如果名单中没有的用户,则提示拒绝登录
  • 原文地址:http://blog.51cto.com/gotoo/2118979

    时间: 2024-08-11 04:00:58

    SSH服务器端/etc/ssh/sshd_conf配置文件详解的相关文章

    Nagios服务器端配置文件详解(2)

    上一步骤: http://blog.csdn.net/mchdba/article/details/25654889 6 配置nagios Nagios 主要用于监控一台或者多台本地主机及远程的各种信息,包括本机资源及对外的服务等.默认的Nagios 配置没有任何监控内容,仅是一些模板文件.若要让Nagios 提供服务,就必须修改配置文件,增加要监控的主机和服务,下面将详细介绍. 6.1 默认配置文件介绍 Nagios 安装完毕后,默认的配置文件在/usr/local/nagios/etc目录下

    ssh环境搭建与管理(详解)

    ssh环境搭建与管理 (详解) 实验环境 服务端:xuegod-63   IP:192.168.1.63 客户端:xuegod-64   IP:192.168.1.64 客户端普通用户:ceshi  密码:123456 安装好扫描软件rpm -ivh /mnt/Packages/nmap-5.21-4.el6.x86_64.rpm 实验目标 1:SSHD服务介绍 2:SSHD服务安装配置 3:两Linux服务器之间数据拷贝 4:SSHD服务作用: 实验步骤 1:搭建环境 1):网桥模式 2):v

    HAproxy简介及其配置文件详解

    一.HAProxy简介HAProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保持或七层处理.HAProxy运行在时下的硬件上,完全可以支持数以万计的并发连接.并且它的运行模式使得它可以很简单安全的整合进您当前的架构中, 同时可以保护你的web服务器不被暴露到网络上.HAProxy实现了一种事件驱动.单一进程模型,此模型支持非常大的并发连接数.多进程或多线程

    Zabbix配置文件详解之服务端——zabbix_server

    作为zabbix的部署,这里就不说了,网上一大堆文档,但关于配置文件的说明就比较少,这里列出服务端的配置文件zabbix_server的详细解释,感谢我主管的功劳. Zabbix Server端配置文件说明 # This is a configuration file for Zabbix Server process # To get more information about Zabbix, # visit http://www.zabbix.com ############ GENERA

    SaltStack 入门到精通第三篇:Salt-Minion配置文件详解

    SaltStack 入门到精通第三篇:Salt-Minion配置文件详解 作者:ArlenJ  发布日期:2014-06-09 17:52:16 ##### 主要配置设置 ##### 配置 默认值 说明 例子 default_include minion.d/*.conf master可以从其他文件读取配置,默认情况下master将自动的将master.d/*.conf中的配置读取出来并应用,其中master.d目录是相对存在于主配置文件所在的目录 default_include: minion

    Haproxy均衡负载部署和配置文件详解

    HAproxy均衡负载部署和配置文件详解 HAProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.根据官方数据,其最高极限支持10G的并发. HAProxy特别适用于那些负载特大的web站点, 这些站点通常又需要会话保持或七层处理.HAProxy运行在当前的硬件上,完全可以支持数以万计的并发连接.并且它的运行模式使得它可以很简单安全的整合进您当前的架构中, 同时可以保护你的web服务器不被暴露到网络上. 其支持从4层至7层的网络

    zabbix_server.conf配置文件详解

    zabbix_server.conf配置文件详解 AlertScriptsPath默认值:/usr/local/share/zabbix/alertscripts说明:告警脚本目录 AllowRoot默认值:0 说明:是否允许使用root启动,0:不允许,1:允许,默认情况下她会使用zabbix用户来启动zabbix进程,不推荐使用root CacheSize取值范围: 128K-8G默认值:8M说明:配置缓存,用于存储host,item,trigger数据,2.2.3版本之前最大支持2G,目前

    salt-minion配置文件详解

    本文系统:centos6.5 [[email protected] salt]# rpm -qa |grep salt salt-minion-2014.1.7-3.el6.noarch salt-master-2014.1.7-3.el6.noarch salt-2014.1.7-3.el6.noarch salt-minion位置: /etc/salt/minion ##### Primary configuration settings ##### #default_include: mi

    zabbix配置文件详解

    zabbix配置文件详解 一.配置文件类型 zabbix_server配置文件:zabbix_server.conf zabbix_proxy配置文件:zabbix_proxy.conf zabbix-agentd配置文件:zabbix_agentd.conf 二.配置文件详解 zabbix_server.conf   # This is a configuration file for Zabbix Server process   # To get more information abou