查看linux的shhd端口号 netstat | grep sshd

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# netstat | grep sshd

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# netstat -utpln | grep sshd

tcp        0      0 0.0.0.0:43559               0.0.0.0:*                   LISTEN      1432/sshd           

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# 

 

[root@iZ2zef51hufoaycipfxek8Z ~]# netstat | grep sshd

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# netstat -utpln | grep sshd

tcp        0      0 0.0.0.0:43559               0.0.0.0:*                   LISTEN      1432/sshd           

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# 

[root@iZ2zef51hufoaycipfxek8Z ~]# 

netstat | grep sshd

 

 

 

命令:vi /etc/ssh/sshd_config
找到#Port 22

把前面的#删掉,在下面再添加一行

Port 5000

命令:/bin/systemctl restart  sshd.service  

重启服务。

命令:firewall-cmd --zone=public --add-port=5000/tcp --permanent  

把5000端口添加到防火墙

命令:firewall-cmd --reload

重新载入。
试一下连接5000端口,好使的话把22端口删掉。
---------------------
作者:weixin_35501548
来源:CSDN
原文:https://blog.csdn.net/weixin_35501548/article/details/78720282
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/xingchong/p/10244221.html