Linux ssh多个端口开启
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
Linux ssh的多个端口开启
通常情况下,ssh的远程端口是22,但是也有部分需求在除22之外的端口远程连接。在系统环境CentOS7.6下想要多开几个端口用于ssh登录。最简单的方法自然是修改ssh的配置文件,在多个端口重启ssh服务;具体步骤:
执行命令:
1.echo Port <端口号> >> /etc/ssh/sshd_config ###开启多个ssh服务端口(可以多开几个)
2.Systemctl restart sshd ###重启ssh服务
3.Systemctl status sshd ###查看是否在端口处开启ssh服务
如图:(同时开启了22和5555端口)
Ssh 服务在所开端口启动之后,需要开通防火墙请求连接的端口;一般使用iptables命令开启防火墙端口,具体命令:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport <端口号> -j ACCEPT
或者修改/etc/sysconfig/iptables文件,增加如下一行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport <端口号> -j ACCEPT
修改完毕后,重启防火墙:
Service iptables restart 或者 systemctl restart iptables.service
上述步骤都确认无误地执行下来后,一般可以ssh其他端口登录linux服务器了。




A beautiful web dashboard for Linux
最近提交(Master分支:9 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
所有评论(0)