尧图网络科技YAOTU DIGITAL 获取报价
获取报价
首页 / 资讯中心 / 文章详情

CentOS7 配置 SSH监听多个端口方法

发布时间:2026/9/29 11:23:26

资讯中心
01
ARTICLE

CentOS7 配置 SSH监听多个端口方法

CentOS7 配置 SSH监听多个端口方法
一、修改ssh默认端口防止暴力破解让系统安全多一点点i. 在配置文件/etc/ssh/sshd_config文件中修改17 Port 5522 18 #AddressFamily any 19 #ListenAddress 0.0.0.0 20 #ListenAddress ::ii. 然后重启sshd[rootlocalhost ~]# systemctl restart sshdiii. 如果自定义端口重启sshd出现如下报错[rootlocalhost ~]# systemctl restart sshd Job for sshd.service failed because the control process exited with error code. See systemctl status sshd.service and journalctl -xe for details.查看详细如下View Codeiv. 解决办法关闭SELinux即可# 临时关闭 [rootlocalhost ~]# setenforce 0 # 永久关闭 [rootlocalhost ~]# vim /etc/selinux/config --------------------修改配置------------------------ SELINUXdisabledv. 检查是否成功注如果重启sshd成功没有出现报错但是检查端口时无效也是跟SELinux有关请把它Disable。[rootlocalhost ~]# netstat -ntlp | grep sshd tcp 0 0 0.0.0.0:5522 0.0.0.0:* LISTEN 3166/sshd tcp6 0 0 :::5522 :::* LISTEN 3166/sshd二、配置sshd监听多端口注必须把上面的port 5522注释掉然后增加listenAddress[rootlocalhost ~]# vim /etc/ssh/sshd_config ---------------- 配置如下 ---------------- #Port 5522 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: ListenAddress 0.0.0.0:22 ListenAddress 0.0.0.0:5522重启sshd[rootlocalhost ~]# systemctl restart sshd检查是否成功注如果配置无效请检查SELinux是否Disable[rootlocalhost ~]# netstat -ntlp | grep sshd tcp 0 0 0.0.0.0:5522 0.0.0.0:* LISTEN 3323/sshd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3323/sshd
02
RELATED NEWS

相关资讯

更多网站建设与数字化升级内容

03
WHY YAOTU

想打造同款高转化官网?

懂行业、懂生意,从建站到增长一站式陪跑

◈

场景化定制

不做模板站,围绕你的业务场景量身设计,小众不撞款。

◐

营销型架构

以转化目标组织内容与路径,让官网真正带来询盘。

▲

全周期服务

设计、开发、运营、运维一体,上线只是开始。

免费获取你的建站方案

留下需求,专属顾问 24 小时内为你输出方案建议。