SSH远程登陆配置sshd_config文件详解
ssh是linux远程登录的安全协议,是 C/S 模式的架构,配置文件分为服务器端配置文件 [/etc/ssh/sshd_config] 与客户端配置文件默认配置文件[/etc/ssh/ssh_config] 用户配置文件[~/.ssh/config] sshd_config 是服务端主配置文件。这个文件的宿主应当是root,权限最大可以是”644”, ssh由客户端和服务端的软件组成,在客户端可以使用的软件有SecureCRT、putty、Xshell等,而在服务器端运行的是一个sshd的服务,通过使用SSH,可以把所有传输的数据进行加密,而且也能够防止dns和IP欺骗,此外,SSH传输的数据是经过压缩的,可以加快传输速度
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy 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 <==在开启selinux的系统上,修改ssh端口的要修改selinux规则,用此命令修改
#
#Port 22 <==默认ssh端口,生产环境中建议改成五位数的端口
#AddressFamily any <==地址家族,any表示同时监听ipv4和ipv6地址
#ListenAddress 0.0.0.0 <==监听本机所有ipv4地址
#ListenAddress :: <==监听本机所有ipv6地址
HostKey /etc/ssh/ssh_host_rsa_key <==ssh所使用的RSA私钥路径
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key <==ssh所使用的ECDSA私钥路径
HostKey /etc/ssh/ssh_host_ed25519_key <==ssh所使用的ED25519私钥路径 # Ciphers and keying
#RekeyLimit default none # Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV <==设定在记录来自sshd的消息的时候,是否给出“facility code”
#LogLevel INFO <==日志记录级别,默认为info # Authentication: #LoginGraceTime 2m <==限定用户认证时间为2min
#PermitRootLogin yes <==是否允许root账户ssh登录,生产环境中建议改成no,使用普通账户ssh登录
#StrictModes yes <==设置ssh在接收登录请求之前是否检查用户根目录和rhosts文件的权限和所有权,建议开启
#MaxAuthTries 6 <==指定每个连接最大允许的认证次数。默认值是 6
#MaxSessions 10 <==最大允许保持多少个连接。默认值是 10 #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 <==公钥验证文件路径 #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 <==指定服务器在使用 ~/.shosts ~/.rhosts /etc/hosts.equiv 进行远程主机名匹配时,是否进行反向域名查询
#IgnoreUserKnownHosts no <==是否在 RhostsRSAAuthentication 或 HostbasedAuthentication 过程中忽略用户的 ~/.ssh/known_hosts 文件
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes <==是否在 RhostsRSAAuthentication 或 HostbasedAuthentication 过程中忽略 .rhosts 和 .shosts 文件 # To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no <==是否允许空密码
PasswordAuthentication yes <==是否允许密码验证,生产环境中建议改成no,只用密钥登录 # Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no <==是否允许质疑-应答(challenge-response)认证 # Kerberos options
#KerberosAuthentication no <==是否使用Kerberos认证
#KerberosOrLocalPasswd yes <==如果 Kerberos 密码认证失败,那么该密码还将要通过其它的认证机制(比如 /etc/passwd)
#KerberosTicketCleanup yes <==是否在用户退出登录后自动销毁用户的 ticket
#KerberosGetAFSToken no <==如果使用了AFS并且该用户有一个 Kerberos 5 TGT,那么开启该指令后,将会在访问用户的家目录前尝试获取一个AFS token
#KerberosUseKuserok yes # GSSAPI options
GSSAPIAuthentication yes <==是否允许基于GSSAPI的用户认证
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 <==是否通过PAM验证 #AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no <==是否允许远程主机连接本地的转发端口
X11Forwarding yes <==是否允许X11转发
#X11DisplayOffset 10 <==指定sshd(8)X11转发的第一个可用的显示区(display)数字。默认值是10
#X11UseLocalhost yes <==是否应当将X11转发服务器绑定到本地loopback地址
#PermitTTY yes
#PrintMotd yes <==指定sshd(8)是否在每一次交互式登录时打印 /etc/motd 文件的内容
#PrintLastLog yes <==指定sshd(8)是否在每一次交互式登录时打印最后一位用户的登录时间
#TCPKeepAlive yes <==指定系统是否向客户端发送 TCP keepalive 消息
#UseLogin no <==是否在交互式会话的登录过程中使用 login(1)
#UsePrivilegeSeparation sandbox <==是否让 sshd(8) 通过创建非特权子进程处理接入请求的方法来进行权限分离
#PermitUserEnvironment no <==指定是否允许sshd(8)处理~/.ssh/environment以及 ~/.ssh/authorized_keys中的 environment= 选项
#Compression delayed <==是否对通信数据进行加密,还是延迟到认证成功之后再对通信数据加密
#ClientAliveInterval 0 <==sshd(8)长时间没有收到客户端的任何数据,不发送"alive"消息
#ClientAliveCountMax 3 <==sshd(8)在未收到任何客户端回应前最多允许发送多个"alive"消息,默认值是 3
#ShowPatchLevel no
#UseDNS no <==是否使用dns反向解析
#PidFile /var/run/sshd.pid <==指定存放SSH守护进程的进程号的路径
#MaxStartups 10:30:100 <==最大允许保持多少个未认证的连接
#PermitTunnel no <==是否允许tun(4)设备转发
#ChrootDirectory none
#VersionAddendum none # no default banner path
#Banner none <==将这个指令指定的文件中的内容在用户进行认证前显示给远程用户,默认什么内容也不显示,"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及其路径 # Example of overriding settings on a per-user basis
#Match User anoncvs <==引入一个条件块。块的结尾标志是另一个 Match 指令或者文件结尾
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
配置修改完成后执行如下命令生效:
/bin/systemctl start sshd.service
SSH远程登陆配置sshd_config文件详解相关推荐
- DCN-2655 ssh 远程登陆配置
DCN-2655 ssh 远程登陆配置: 命名路由器: 在全局模式配置AAA认证列表: 配置登录地址: 配置虚拟端口认证: 配置sshd服务: 命名路由器: Router>enable Rout ...
- vue-cli脚手架配置基础文件详解/新手入门必看
vue-cli 脚手架中webpack 配置基础文件详解 需要Word版本 的小伙伴可以发我邮件2445478193@qq.com 一.前言 vue-cli是构建vue单页应用的脚手架,输入一串指定的 ...
- ssh远程登陆配置、公私钥密码ssh体系构建
一.远程登陆服务openssh openssh服务器提供ssh远程加密登陆,常用于公网,加密数据传输过程中安全,默认装机最小化时候也是装好的,sshd服务配置文件是/etc/ssh/sshd_conf ...
- SSH远程连接原理及操作详解
参考资料SSH登录原理_藏红的博客-CSDN博客 SSH全称是Secure Shell,SSH协议是基于应用层的协议,为远程登录会话和其他网络服务提供安全性的协议.SSH使用最多的是远程登录和传输文件 ...
- vue-cli脚手架中webpack配置基础文件详解
一.前言 vue-cli是构建vue单页应用的脚手架,输入一串指定的命令行从而自动生成vue.js+wepack的项目模板.这其中webpack发挥了很大的作用,它使得我们的代码模块化,引入一些插件帮 ...
- Debian8 Linux上安装SSH服务器并配置sshd_config文件启用root ssh登录
Debian Linux上安装SSH服务器 安装SSH服务器debian Linux允许我们通过ssh协议登录debian服务器.SSH是从远程位置登录debian的首选方法,因为ssh协议通过Int ...
- telnet与ssh远程登陆配置方法
一.实验需求: 1.路由器1的G0/0的端口配置IP 192.168.1.1 255.255.255.0 2.路由器2的G0/0的端口配置IP 192.168.1.2 255.255.255.0 3. ...
- selenium入门配置docker-compose文件详解
docker-compose.yml docker的编排功能即compose,最基本的语法就是写docker-compose.yml文件来实现,其中一些配置信息根据个人理解作以下笔记: 对于compo ...
- [学习笔记 ]IAR的链接配置.icf文件详解——RT1052芯片的链接文件
本文主要通过以下几个部分解释IAR中的链接配置icf文件: 1.参考解析IAR的ILink链接器icf配置文件介绍icf文件作用以及icf文件主要内容: 2.介绍icf常使用的命令 3.RT1052芯 ...
- 树莓派命令行配置无线网络和SSH远程登陆
无线网络配置 查找可用的网络 pi@raspberrypi:~ $ sudo iwlist wlan0 scanwlan0 Scan completed :Cell 01 - Address: 9C: ...
最新文章
- log4j中调试与错误日志分开_idea中log4j日志插件报错
- open api的鉴权以及oauth2.0协议
- tensorflow kears GPU CUDA Cudnn 各种版本问题
- sales status change in ERP
- iOS: TableView如何刷新指定的cell 或section
- 转HTML、CSS、font-family:中文字体的英文名称
- STL 源码剖析 空间配置器
- mysql床数据库的命令_3种PHP连接MYSQL数据库的常用方法
- java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start com
- IOS开发之日期时间格式化字符说明
- 图解 CSS (2): border - 边框
- c语言字符串转换xml文件名,如何用C语言生成简单格式的xml
- 【Java】---JVM内存模型
- 【MATLAB】MATLAB三维曲面绘制【详细教程】
- 2017第25届春季中西部(重庆)医疗器械展览会会刊(参展商名录)
- matlab与comsol的连接
- 微信小程序实践——实验1获取用户信息
- 做笔记的方法—— 推荐笔记方法Word方式
- java向量加法_结构-03. 平面向量加法(10) java
- phoenix 安装以及开启后报错
热门文章
- HeidiSQL使用教程
- B站(云e办)SpringBoot实战练习的Sql文件、前端Vue源码、后端springboot源码
- 【图像重构】基于OMP算法实现图像重构附matlab代码
- 昆仑mcgs 通讯控制台达B2伺服采用modbus rtu方式,昆仑屏直接控制台达b2伺服的正反转,停止及速度设定,简单好上手
- 蓝桥杯单片机历年真题答案
- fiddler的安装与配置
- C语言课程设计|学生成绩管理系统(含完整代码)
- 《深入浅出数据分析》读书笔记
- 视频教程-C++ 编写WebService服务实战-C/C++
- maple软件安装教程