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

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

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

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连接端口号” 的相关文章

使用批处理命令批量提取文件夹内所有文件名命令

将以下代码用记事本保存为.bat格式支行即可DIR *.*  /B >LIST.TXT...

dell idrac使用 Web 界面启用 FIPS 模式

在 iDRAC Web 界面中,导航至 iDRAC Settings(iDRAC 设置) > Connectivity(连接) > Network(网络) > Network Settings(网络设置)&nbs...

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

ubuntu 18.04 开启ssh服务

ubuntu 18.04 开启ssh服务

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