如何修改ssh默认端口
修改的是 /etc/ssh/sshd_config 文件
[root@linux ~]# vi /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy 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:/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 override the
# default value.
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 10008 //默认是有 # 号的,而且默认是 22 ,修改一下就ok了
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
重起ssh服务,修改端口才生效
[root@linux ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@linux ~]#
注意修改端口,记得添加防火墙
[root@linux ~]# firewall-cmd --zone=public --add-port=10008/tcp --permanent
[root@linux ~]# firewall-cmd --reload