SSH 服务使用的标准端口是 22/TCP。但是,您可能希望更改 SSH 默认端口 22,以确保您的服务器尽可能安全,因为标准 22/TCP 端口一直是互联网上黑客和机器人程序漏洞的目标。
vi /etc/ssh/sshd_config |
---|
# Port 22 # Port 23456 |
---|
/etc/init.d/ssh restart or /etc/init.d/sshd restart |
---|
systemctl restart sshd.service |
---|
iptables -I INPUT -p tcp --dport 23456 -j ACCEPT systemctl restart iptables.service |
---|
firewall-cmd --zone=public --add-port=23456/tcp --permanent firewall-cmd --reload |
---|
以防万一。没有人想被锁定在他自己的服务器之外。
在本教程中,您学习了如何更改 Linux 服务器上的 SSH 端口。
如果您有任何问题或反馈,请随时发表评论。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有