SSH的端口号是多少?

2023-05-16 综合 26阅读
ssh默认端口号是22。但在实际应用的时候会需要更改ssh的默认端口号。
下面简单说说linux下如何更改ssh的端口号。
1、 修改 /etc/ssh/sshd_config 文件。
[root@linux ~]# vi /etc/ssh/sshd_config
# $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker 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 8284 //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了
#Protocol 2,1
#ListenAddress 0.0.0.0
#ListenAddress ::
# 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
2、重起ssh服务,修改端口才生效
[root@linux ~]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@linux ~]#
3、为了检验是否穗斗前正确,可以使用 netstat -an 命令查看一下。
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com