CentOS-Stream-10 Secure Shell服务器sshd_config配置文件

sshd_config SSH服务器端配置

bash 复制代码
#   #号为注释,注释中的命令是默认配置,如需更改内容生效请去掉注释

#允许侦听tcp端口号
# semanage port -a -t ssh_port_t -p tcp 2222
# semanage port -a -t ssh_port_t -p tcp  端口号

#默认端口号,可改为其他
#Port 22

#限制ssh服务器使用哪一类型地址,任何/ipv4/ipv6 <any|inet|inet4>
#AddressFamily any

#侦听所有的本地ssh通信
#ListenAddress 0.0.0.0     #所有ipv4
#ListenAddress ::					#所有ipv6

#密钥安全性ed25519>ecdsa>rsa 不需要更改位置 
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# 多长时间重新协商会话密钥,none没有限制
#RekeyLimit default none


#/etc/rsyslog.conf文件的配置
#SyslogFacility AUTH       #所有和AUTHPRIV有关的消息记录到/var/log/secure
#LogLevel INFO       #信息级别

# Authentication:

#限制拒绝服务dos,默认时间2m,超2m没登录上,断开连接
#LoginGraceTime 2m

#管理员权限登录<yes|no|prohibit-password>
#PermitRootLogin prohibit-password  #强制使用密钥认证(如公钥/私钥对),禁止使用密码认证 

#普通用户登录管理员权限可使用su或sudo命令
#StrictModes yes

#检查用户主目录和ssh密钥是否设置了合适的权限,然后授权登录
#每个连接身份验证尝试默认次数6次
#MaxAuthTries 6	  

#开放ssh会话10个
#MaxSessions 10

#ssh v2版本 公钥/私钥的身份认证
#PubkeyAuthentication yes

#使用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

#使用/etc/hosts.equiv文件限制连接的主机<yes|no>
# HostbasedAuthentication

#.ssh/known_hosts文件保存远程系统的公钥<yes|no>
#IgnoreUserKnownHosts no

#管理员从RSH转换到SSH,它们使用.rhost和.shosts文件<yes|no>
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

#私钥/公钥身份认证<yes|no>
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes

#空口令<yes|no>,有安全风险
#PermitEmptyPasswords no

#启用键盘交互式认证(Keyboard-Interactive Authentication)
# Change to no to disable s/key passwords
#KbdInteractiveAuthentication yes


#ssh v1版本kerberos身份验证
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes


#ssh v2版本kerbreos身份验证通用安全服务应用程序编程接口(gssapi)
# GSSAPI options
#GSSAPIAuthentication no
#登出后销毁证书
#GSSAPICleanupCredentials yes
#非常严格检查主机名
#GSSAPIStrictAcceptorCheck yes
#gssapi密钥交换
#GSSAPIKeyExchange no

#是否启用基于gssapi的Kerberos认证
#GSSAPIEnablek5users no

#支持通过PAM模块进行身份验证
#UsePAM no

#允许ssh-agent命令将私钥转发给其他远程系统
#AllowAgentForwarding yes

#ssh连接转发TCP通信
#AllowTcpForwarding yes

#远程主机不能连接转发端口
#GatewayPorts no

图形化连接转发    ssh -X 用户名@地址
#X11Forwarding no

#10个图形化显示
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes

#远程登录后能否看见/etc/motd文件内容
#PrintMotd yes

#存档最后登录系统的时间
#PrintLastLog yes

#启用TCP keepalive消息,以免连接ssh客户端终端时,会话无限挂起
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed

#ssh服务器确保用户还要传输数据
#ClientAliveInterval 0

#客户端自动断开连接前能够发送的消息数量
#ClientAliveCountMax 3

#依据dns服务器或/etc/hosts文件检查远程主机名,降低欺骗风险
#UseDNS 

#正在运行的ssh服务器进程的进程id号
#PidFile /var/run/sshd.pid

#限制ssh服务器能够处理的未验证连接数量
#MaxStartups 10:30:100

是否支持设备转发
#PermitTunnel no

#指定目录执行choot操作
#ChrootDirectory none

#
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
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
相关推荐
AnalogElectronic1 分钟前
linux 测试网络和端口是否连通的命令详解
linux·网络·php
Edward1111111136 分钟前
4月28日防火墙问题
linux·运维·服务器
子琦啊1 小时前
【算法复习】字符串 | 两个底层直觉,吃透高频题
linux·运维·算法
AOwhisky2 小时前
Kubernetes 学习笔记:集群管理、命名空间与 Pod 基础
linux·运维·笔记·学习·云原生·kubernetes
小龙在慢慢变强..3 小时前
目录结构(FHS 标准)
linux·运维·服务器
2035去旅行3 小时前
嵌入式开发,如何选择C标准库
linux·arm开发
刘延林.3 小时前
win11系统下通过 WSL2 安装Ubuntu 24.04 使用RTX 5080 GPU
linux·运维·ubuntu
CodeOfCC4 小时前
Linux 嵌入式arm64安装openclaw
linux·运维·服务器
宵时待雨5 小时前
linux笔记归纳3:linux开发工具
linux·运维·笔记
magrich5 小时前
安装NoMachine并解决无外接显示器桌面黑屏
linux·运维·服务器