在使用雲服務器的過程中發現有***遠程暴力破解我的ssh端口,爲避免該安全隱患應更改ssh服務的默認端口號。
ssh的配置文件保存在/etc/ssh/sshd_config 文件中
[root@jdu4e00u53f7 ~]# vim /etc/ssh/sshd_config 文件打開後如下
# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.
#Port 22 此處去掉#,並將22修改爲你想使用的端口號,但修改後端口號不可與其他服務發生衝突。
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
[root@jdu4e00u53f7 ~]# service sshd restart 修改文件後應重啓服務使配置生效