在使用云服务器的过程中发现有黑客远程暴力破解我的ssh端口,为避免该安全隐患应更改ssh服务的默认端口号。
ssh的配置文件保存在/etc/ssh/sshd_config 文件中
[[email protected] ~]# 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
[[email protected] ~]# service sshd restart 修改文件后应重启服务使配置生效