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

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

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

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刻录...

HTML网页自动跳转代码整理

网页自动跳转代码方法很多,在这里专门为大家提供网页自动跳转代码方法,希望可以帮助到大家实现网页自动跳转。1、html网页跳转代码在网页头部<1head>…</head>之间插入以下代码<meta http-equiv="refresh"&n...

ubuntu 18.04 开启ssh服务

ubuntu 18.04 开启ssh服务

一、安装openssh-service命令: sudo apt install openssh-server二、启动ssh服务命令: sudo service ssh start检查是否启动成功: ps -aux | grep ''ssh'...

ubuntu20.04 配置root登录和ssh root登录

ubuntu20.04 配置UI root登录和ssh root登录 一、开启root用户sudo passwd root二、修改配置文件 2.1sudo vi /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf增...

Centos开机提示Give root password for maintenance(or press Control-D to continue):

Centos开机提示Give root password for maintenance(or press Control-D to continue):

输入系统密码登录然后vim /etc/fstab,将挂在失败的逻辑卷从fstab中注释掉,然后再次执行mount -o remount,rw / mount -a reboot...