centos7开启sshd多端口登录及修改端口

星期三, 2019-12-04 | Author: Lee | Database, linux | 2,411 views

0.不知道怎么回事 一台国外的机器的ssh的22端口,时常无法ssh连接,因此多加个端口来备用

1.编辑配置文件打开Port=22 或者修改此端口

vi /etc/ssh/sshd_config

Port 22
Port 1022

2.重启sshd服务

systemctl restart sshd

3.查看服务启动情况

netstat -lntp

4.防火墙放行

iptables -A INPUT -p tcp --dport 1022 -j ACCEPT

5.使用xshell等连接即可

可以同时使用22及1022的端口进行sshd连接服务器了

Tags: ,

文章作者: Lee

本文地址: https://www.pomelolee.com/1962.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

3 Comments to centos7开启sshd多端口登录及修改端口

Lee
2020 年 06 月 05 日

service iptables save

保存防火墙规则

Lee
2020 年 06 月 05 日

systemctl restart sshd.service
重启服务

pomelolee
2021 年 07 月 22 日

#关闭所有22访问
iptables -I INPUT -p tcp –dport 22 -j DROP
#开放指定ip访问
iptables -I INPUT -s 127.0.0.1 -p tcp –dport 22 -j ACCEPT

Leave a comment

Search

文章分类

Links

Meta