Centos7.3更换ssh默认登陆端口

  1. 首页
  2. 学习文档
  3. 正文

Centos7.3更换ssh默认登陆端口


Centos7.3更换ssh默认登陆端口
说明:本方法目前通用于7.1-7.3
 
vim /etc/ssh/sshd_config 
找到Port 22下面添加一行:
Port 12345
保存退出。
 
systemctl restart sshd.service 
netstat -ntlp|grep 12345 查看12345端口号监听情况
 
systemctl start firewalld 打开防火墙
firewall-cmd --permanent --add-port=12345/tcp 添加端口例外
firewall-cmd --permanent --query-port=12345/tcp 查询是否已经开启例外
 
systemctl restart sshd
systemctl restart firewalld.service
 
原文来源:雨竹林学习网http://www.yuzhulin.com