- 论坛徽章:
- 0
|
更改ssh监听端口的问题
原帖由 "platinum" 发表:
和/etc/services没任何关系
需要找到正确位置的sshd_config,然后修改其端口号,重启sshd服务
因为不同的安装方式,sshd_config的文件位置不同,而且可能不只一个
我用的是redhat9,rpm自带安装,vi /etc/ssh/sshd_config然后重起netstat结果如下:
# $OpenBSD: sshd_config,v 1.59 2002/09/25 11:17:16 markus 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 1234
#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
"sshd_config" 95L, 2476C written
[root@localhost ssh]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@localhost ssh]# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 3454/
tcp 0 0 127.0.0.1:32769 0.0.0.0:* LISTEN 3572/xinetd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3435/
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7621/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3592/
udp 0 0 0.0.0.0:32768 0.0.0.0:* 3454/
udp 0 0 0.0.0.0:662 0.0.0.0:* 3454/
udp 0 0 0.0.0.0:111 0.0.0.0:* 3435/
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 3611 3611/gpm /dev/gpmctl |
|