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

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

admin3年前 (2022-10-30)技术教程1860

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 r720 开启超线程

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

Dell R720服务器bios升级报错解决方法

Lifecycle Controller 未启用。 要启用 Lifecycle Controller,请重新引导服务器。 在 POST 期间,请按 F2 进入“系统设置”。 转到 iDRAC 设置-> Lifecycle Controller,选择“启用”,然后保...

破解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...