前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux 修改linux的SSH的默认端口

Linux 修改linux的SSH的默认端口

作者头像
授客
发布2019-09-11 20:35:43
3.9K0
发布2019-09-11 20:35:43
举报
文章被收录于专栏:授客的专栏授客的专栏

安装完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

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

步骤二:重启服务

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2014-11-19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档