惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
量子位
T
Tailwind CSS Blog
T
Threatpost
The GitHub Blog
The GitHub Blog
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LangChain Blog
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
T
Troy Hunt's Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
T
Tor Project blog
T
The Blog of Author Tim Ferriss
I
Intezer
P
Privacy & Cybersecurity Law Blog
美团技术团队
N
Netflix TechBlog - Medium
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
Google Developers Blog
Attack and Defense Labs
Attack and Defense Labs
T
Tenable Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Last Week in AI
Last Week in AI

Rat's Blog - ssh

Linux VPS安装Google Authenticator实现SSH登陆二次验证 - Rat's Blog Xshell 6官方永久免费版,可解决评估期已过的提示问题 - Rat's Blog 一款全新且强大的SSH客户端:FinalShell - Rat's Blog 一款非常好用的Web端SSH工具:GateOne安装教程 - Rat's Blog JuiceSSH/Termius:安卓/IOS平台上好用且免费的SSH客户端 - Rat's Blog 一个可以在浏览器上运行的SSH客户端:WebSSH2安装教程 - Rat's Blog SSH密钥安装器升级,一键安装VPS密钥安全登录 - Rat's Blog 为Linux VPS配置SSH-KEY登录并禁用root密码 - Rat's Blog Ubuntu 安装Fail2ban服务来防止暴力破解FTP/SSH - Rat's Blog
Linux VPS服务器SSH端口一键修改脚本 - Rat's Blog
博主: Rat's · 2017-11-03 · via Rat's Blog - ssh
  •  发布时间:
  •  25962 次浏览
  •   10 条评论
  •  1004 字数
  • 分类: 主机教程
  1.  首页
  2. 正文  
  3. 分享到:

说明:我们的很多VPS服务器,默认的端口都是22,所以一直会被人扫描爆破,很容易会出现问题,所以我们需要通过修改端口来尽可能减少这种事情发生,之前发过手动修改教程,参考:Linux VPS主机安全设置 - 修改VPS默认SSH端口,但对于很多小白或者很懒的人来说,更喜欢一键脚本就能完成的方法,这里就整了个SSH端口一键修改脚本。从OneinStack一键安装包上扒下来的。

方法

系统要求:支持DebianUbuntuCentOS系统。
运行以下命令:

wget https://www.moerats.com/usr/down/sshport.sh
bash sshport.sh

输入端口确认。再打开防火墙端口:

#如果防火墙使用的iptables(Centos 6),修改端口为8080
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
service iptables save
service iptables restart
#如果使用的是firewall(CentOS 7)
firewall-cmd --zone=public --add-port=8080/tcp --permanent 
firewall-cmd --reload

最后重启ssh生效:

#CentOS系统
service sshd restart
#Debian/Ubuntu系统
service ssh restart

然后就可以使用新端口SSH登录了,不过对于更安全的登录方式当属使用密钥登录了,具体设置可参考文章:SSH密钥安装器升级,一键安装VPS密钥安全登录为Linux VPS配置SSH-KEY登录并禁用root密码


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/394/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。

Vultr新用户注册送100美元/16个机房按小时计费,支持支付宝,【点击查看】。