Linux 修改linux的SSH的默认端口

修改linuxSSH的默认端口

by:授客 QQ1033553122

安装完linux后,默认的情况下ssh是开放的,容易造到黑客攻击,简单有效的操作之一就是修改默认端口号

 

步骤一:修改/etc/ssh/sshd_config配置文件

找到行:Port 22 注释掉,添加行:Port其它端口号

builder:/mnt/disk/pcap# vim /etc/ssh/sshd_config

 

# Package generated configuration file

# See the sshd(8) manpage for details

 

# What ports, IPs and protocols we listen for

#Port 22

Port 50000

# Use these options to restrict which interfaces/protocols sshd will bind to

#ListenAddress ::

#ListenAddress 0.0.0.0

Protocol 2

# HostKeys for protocol version 2

HostKey /etc/ssh/ssh_host_rsa_key

HostKey /etc/ssh/ssh_host_dsa_key

#Privilege Separation is turned on for security

UsePrivilegeSeparation yes

 

# Lifetime and size of ephemeral version 1 server key

KeyRegenerationInterval 3600

ServerKeyBits 768

 

# Logging

注意:这里的端口修改会影响SCPSSH等命令的使用,因为执行命令时使用的这里的端口

 

步骤二:重启服务

builder:/mnt/disk/pcap# service sshd restart

posted @   授客  阅读(528)  评论(0编辑  收藏  举报
编辑推荐:
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
点击右上角即可分享
微信分享提示