centos7修改端口登陆

1 安装ssh服务  yum install -y openssh-server
2 修改默认端口并保存  vim /etc/ssh/sshd_config

  

3 打开防火墙  service firewalld start
4 开放指定端口  firewall-cmd --zone=public --add-port=1995/tcp --permanent
5 刷新防火墙  firewall-cmd --reload
6 查看是否放行成功  firewall-cmd --zone=public --query-port=1995/tcp

7 安装selinux管理工具 yum provides semanage
8 添加依赖包 yum install -y policycoreutils-python

9 查询当前ssh服务端口 semanage port -l | grep ssh
10  向 SELinux 中添加 ssh 端口: semanage port -a -t ssh_port_t -p tcp 1995
11  查看是否添加成功: semanage port -l | grep ssh

12  重启服务 systemctl restart sshd.service
13  登陆 ssh [email protected] 1995

猜你喜欢

转载自www.cnblogs.com/wlwl/p/10007166.html