当前位置:首页 > 技术教程 > 正文内容

查看ssh端口号_更改centos系统ssh连接端口号

admin1年前 (2022-10-30)技术教程778

1、修改ssh配置文件sshd_config

[root@VM_0_10_centos ~]# vi /etc/ssh/sshd_config

image.png

截图中红色框中的部分,建议先保留22端口号,然后新增自定义端口号

2、防火墙放行

[root@VM_0_10_centos ~]# firewall-cmd –zone=public –add-port=10010/tcp –permanent
[root@VM_0_10_centos ~]# firewall-cmd –reload

3、向SELinux中添加修改的SSH端口

3.1 先安装SELinux的管理工具 semanage (如果已经安装了就直接到下一步)

[root@VM_0_10_centos ~]# yum provides semanage

3.2 安装运行semanage所需依赖工具包 policycoreutils-python:

[root@VM_0_10_centos ~]# yum -y install policycoreutils-python

3.3 查询当前 ssh 服务端口:

[root@VM_0_10_centos ~]# semanage port -lgrep ssh


7adfcc6f698e222b46f6b8b244680a6a.png

3.4 向 SELinux 中添加 ssh 端口:

[root@VM_0_10_centos ~]# semanage port -a -t ssh_port_t -p tcp 10010

3.5 重启 ssh 服务:

[root@VM_0_10_centos ~]# systemctl restart sshd.service

测试成功后,把22端口注释掉即可


扫描二维码推送至手机访问。

版权声明:本文由59519发布,如需转载请注明出处。

本文链接:https://www.59519.com/?id=19

标签: centos
分享给朋友:

“查看ssh端口号_更改centos系统ssh连接端口号” 的相关文章

DELL idrac7 企业版永久激活教程

DELL idrac7 企业版永久激活教程

下载 DELL 官方 部署工具 ,并解压。默认是解压到 C 盘根目录。可执行文件 DDDP.exe 默认在路径 C:\dell\drivers\R169189 下。右键 DDDP.exe,以管理员身份运行。图片效果如下:图 1刻录...

戴尔dell服务器如何进入BIOS及恢复BIOS出厂设置

PowerEdge如何进入BIOS及恢复BIOS出厂设置1、启动计算机,当看到DELL启动画面时,按“F2”键进入BIOS;2、按Num Lock(数字锁定)、Caps Lock(大小写锁定)、Scroll Lock(卷屏锁定)三个按键将小键盘上方的对应的三个指示灯点亮;3、在三个指示灯全部点亮的前...

dell r720 开启超线程

开机按F2,选择system bios,进入BIOS设置界面,然后找到processor setting,将logical processor跟virtualzation technology都选择enabled...

解决新版谷歌浏览器无法显示www/https(插件方式)

解决新版谷歌浏览器无法显示www/https(插件方式)

升级了谷歌浏览器(Google Chrome),升级后发现www部分和https://协议又被Google隐藏掉了,这次Google的做法比较粗暴,无法再通过chrome://flags/设置回来。经过了多方查找,最终只能通过Google提供的扩展插件来解决,如果你有更好的方法请留言给我!本文方法理...

破解CentOS7密码

破解CentOS7密码

1、utf-8 后加 init=/bin/sh       #Ctrl+x 执行启动 2、mount -o remount,rw /   ...

No supported authentication methods available (server sent: publickey)

No supported authentication methods available (server sent: publickey)

1、putty登录出现如下报错:  2、解决方法, 修改配置文件, 重启ssh服务root@DESKTOP-1N42TVH:/home# vim /etc/ssh/sshd_config  重启ssh服务:root@DESKTOP-1N42...