# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 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/bin:/bin:/usr/sbin:/sbin

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

#开放的ssh端口
Port 22

#允许登录的用户
AllowUsers feng

#是否允许root登录
PermitRootLogin no

#监听协议
AddressFamily inet

#设置sshd服务器绑定的ip地址
#ListenAddress 0.0.0.0 #监听所有ipv4地址
#ListenAddress :: #监听所有ipv6地址

#设置计算机密钥路径
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

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

#用来设定如果用户登录失败,在切断连接前服务器需要等待的时间,单位为秒
#LoginGraceTime 2m

#设置ssh在接收登录请求之前是否检查用户根目录和rhosts文件的权限和所有权,建议开启
StrictModes yes

MaxAuthTries 6
#MaxSessions 10

#设置是否开启公钥验证,如果使用公钥验证的方式登录时,则设置为yes
PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#与PubkeyAuthentication配合使用,公钥放在.ssh/authorized_keysi中
AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# 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!
#设置是否开启密码验证机制,如果用密码登录系统,则设置为yes
PasswordAuthentication yes

#设置是否允许为空的账号登录系统,设置为no
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange 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'.
UsePAM yes

#AllowAgentForwarding yes

#是否允许tcp端口转发,保护其他的tcp连接
#AllowTcpForwarding yes

#是否允许远程客户端使用本地主机的端口转发功能
#GatewayPorts no

#------------------- X-Window下的相关规则----------------------------
#是否允许X11转发
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes

#-------------------- 登入后的相关规则 -----------------------
#PermitTTY yes

#设置sshd是否在用户登录时显示'/etc/motd'中的信息,可以在其中加入欢迎信息
PrintMotd no

#显示上次登录信息
PrintLastLog yes

#是否持续连接,设置yes可以防止死链接
#一般而言,如果设定这项目的话,那么 SSH Server 会传送 KeepAlive 的讯息给 Client 端,以确保两者的联机正常!这种消息可以检测到死连接、连接不当关闭、客户端崩溃等异常。在这个情况下,任何一端死掉后, SSH 可以立刻知道,而不会有僵尸程序的发生!
TCPKeepAlive yes

##UseLogin 设置是否在交互式会话的登录过程中使用。默认值是"no"。如果开启此指令,那么X11Forwarding 将会被禁止,因为login不知道如何处理 xauth cookies 。需要注意的是,在SSH底下本来就不接受 login 这个程序的登入,如果指UsePrivilegeSeparation ,那么它将在认证完成后被禁用。
#UseLogin no

#PermitUserEnvironment no
#Compression delayed

#server每隔60秒发送一次请求给client,然后client响应,从而保持连接
ClientAliveInterval 60

#server发出请求后,客户端没有响应得次数达到3,就自动断开连接
ClientAliveCountMax 3

#是否使用DNS反向解析
#UseDNS no

#PidFile /var/run/sshd.pid

##MaxStartups 设置同时允许几个尚未登入的联机,当用户连上ssh但并未输入密码即为所谓的联机,在这个联机中,为了保护主机,所以需要设置最大值,预设为10个,而已经建立联机的不计算入内,所以一般5个即可,这个设置可以防止恶意对服务器进行连接
MaxStartups 2

#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server

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

sshd_config详解的更多相关文章

  1. [转帖]SSH远程登录配置文件sshd_config详解

    SSH远程登录配置文件sshd_config详解 2016年06月02日 17:42:25 Field_Yang 阅读数 61386   版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权 ...

  2. ssh服务配置文件---sshd_config详解

     关于 SSH Server 的整体设定,包含使用的 port 啦,以及使用的密码演算方式 Port 22 # SSH 预设使用 22 这个 port,您也可以使用多的 port !  # 亦即重复使 ...

  3. sshd_config 配置文件参数详解

    sshd_config配置详解 名称sshd_config - OpenSSH SSH 服务器守护进程配置文件 大纲/etc/ssh/sshd_config 描述sshd(8) 默认从 /etc/ss ...

  4. sshd_config配置详解

    sshd_config配置详解 名称 sshd_config - OpenSSH SSH 服务器守护进程配置文件 大纲 /etc/ssh/sshd_config 描述 sshd(8) 默认从 /etc ...

  5. 详解Linux目录(目录树详细解释)

    给大家一篇关于Linux目录 方面的详细说明,好好读一下! Linux目录详解(RHEL5.4) linux有四种基本文件系统类型:--普通文件:如文本文件.c语言源代码.shell脚本等,可以用ca ...

  6. Linux ssh登录和软件安装详解

    阿哲Style   Linux第一天 ssh登录和软件安装详解 Linux学习第一天 操作环境: Ubuntu 16.04 Win10系统,使用putty_V0.63 本身学习Linux就是想在服务器 ...

  7. kill 命令详解 系统信号

    kill  命令详解  系统信号 参考: 了解Linux的进程与线程 http://www.cnblogs.com/MYSQLZOUQI/p/4234005.html Linux就这个范儿 P532 ...

  8. Hadoop 发行版本 Hortonworks 安装详解(一) 准备工作

    一.前言 目前Hadoop发行版非常多,所有这些发行版均是基于Apache Hadoop衍生出来的,之所以有这么多的版本,完全是由Apache Hadoop的开源协议决定的:任何人可以对其进行修改,并 ...

  9. rsync命令详解、rsync用ssh隧道方式同步

    ● rsync格式安装命令 yum install -y rsync与scp的区别:scp复制为完全覆盖,rsync为增量同步,只同步修改过的数据.rsync命令格式如下: rsync 选项 源文件 ...

随机推荐

  1. TensorFlow神经网络集成方案

    TensorFlow神经网络集成方案 创造张力流create_tensorflow_neuropod 将TensorFlow模型打包为neuropod包. create_tensorflow_neur ...

  2. NX二次开发-获取WCS坐标系的原点坐标和矩阵标识

    函数:UF_CSYS_ask_csys_info() 函数说明:获取工作坐标系对象的标识符. 用法: #include <uf.h> #include <uf_csys.h> ...

  3. 从架构师角度谈谈mybatis-plus可能存在的问题

    存在这么一个情况:对于缺营养的人来说,医生更倾向于建议他选择纯牛奶,而不是有机奶(因其有添加剂).然而,大部分人却更加倾向于选择有机奶, 因其口感不错,因此,对于选择纯牛奶还是有机奶,这是个博弈问题. ...

  4. 【题解】 hdu2955 Robberies

    有抱负的罗伊·劫匪已经看过很多美国电影,他知道坏人通常会被抓住,经常是因为他们太贪心了.他决定在银行抢劫案中工作一段时间,然后退休后到一所大学从事一份舒适的工作. 题目: 罗伊去几个银行偷盗,他既想多 ...

  5. 如何使用 jest 和 lint-staged 只检测发生改动的文件

    我们现在在推进 EPC 的过程中,单元测试是必备的技能,在本地的 Git commit 之前进行单测非常有必要,总不能把所有的单测的压力都放在流水线上. 毕竟在流水线运行单测的成本还是挺高的,从 pu ...

  6. 自动删除n天前的日志(此处用于业务删除xml文件)

    Linux应用总结:自动删除n天前的日志 linux是一个很能自动产生文件的系统,日志.邮件.备份等.虽然现在硬盘廉价,我们可以有很多硬盘空间供这些文件浪费,让系统定时清理一些不需要的文件很有一种爽快 ...

  7. WPF使用 INotifyPropertyChanged 实现数据驱动

    如下图,有这么一个常见需求,在修改表单明细的苹果价格时,总价会改变,同时单据总和也随之改变. 按照Winfrom事件驱动的思想来做的话,我们就需要在将UI的修改函数绑定到CellEdit事件中来实现. ...

  8. Vue(6)v-on指令的使用

    v-on 监听事件 可以用 v-on 指令监听 DOM 事件,并在触发时运行一些 JavaScript 代码.事件代码可以直接放到v-on后面,也可以写成一个函数.示例代码如下: <div id ...

  9. 微信订阅号中获取openid以及个人信息

    采用的方式是利用另一个服务号获取用户信息. 其中有一个问题就是不关注这个服务号获取不了用户头像等信息.

  10. Task异常捕获的方式

    这节来讲一下如果捕获Task的异常. 当Task运行中出现了异常,正常情况下我们在主线程的Try是捕获不到的,而如果在Task内部写try,出现了异常我们会完全不知道.下面就来介绍几个主线程捕获Tas ...