日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

RHEL7 修改SSH默认端口

發布時間:2025/3/8 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 RHEL7 修改SSH默认端口 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.查詢seliunx ?

[root@test10597 ~]# getenforce? Enforcing [root@test10597 ~]# semanage port -l|grep ssh ssh_port_t tcp 22

2.設置selinux端口

[root@test10597 ~]# semanage port -a -t ssh_port_t -p tcp 10022 [root@test10597 ~]# semanage port -l|grep shh [root@test10597 ~]# semanage port -l|grep ssh ssh_port_t tcp 10022, 22若想添加其他已定義的端口(如443)到SSH,可使用-m修改命令,# semanage port -m -t ssh_port_t -p tcp 443直接使用-a命令添加443端口會報錯:ValueError: Port tcp/443 already defined

3.修改ssh配置文件

4.更改防火墻

[root@test10597 ~]# cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/ [root@test10597 ~]# vim /etc/firewalld/services/ssh.xml [root@test10597 ~]# firewall-cmd --add-service=ssh --permanent success [root@test10597 ~]# firewall-cmd --reload success [root@test10597 ~]# firewall-cmd --list-all public (active)target: defaulticmp-block-inversion: nointerfaces: ens192sources: services: dhcpv6-client sshports: 80/tcp 10022/tcpprotocols: masquerade: noforward-ports: source-ports: icmp-blocks: rich rules: [root@test10597 ~]# firewall-cmd --list-service dhcpv6-client ssh

4.重啟ssh

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

5.刪除selinux

semanage port -d -t ssh_port_t -p tcp 22

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的RHEL7 修改SSH默认端口的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。