免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6088 | 回复: 16
打印 上一主题 下一主题

[网络管理] 更改ssh监听端口的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-03-03 17:05 |只看该作者 |倒序浏览
想把默认的ssh端口22更改掉,我更改了ssh_config 和sshd_config中的port的值,但是保存后reboot后,ssh还是在22登陆。还需要更改哪里,才能生效,前辈指点一下

论坛徽章:
0
2 [报告]
发表于 2005-03-03 17:07 |只看该作者

更改ssh监听端口的问题

改/etc/services和sshd_config

论坛徽章:
0
3 [报告]
发表于 2005-03-08 09:45 |只看该作者

更改ssh监听端口的问题

我更改了这两个配置文件的port,还是不行啊,能不能告诉我具体一点,我是新手!多谢了!

论坛徽章:
0
4 [报告]
发表于 2005-03-08 10:43 |只看该作者

更改ssh监听端口的问题

还要启动一下sshd服务,对了,你用客户端什么登录如果是putty登录时要修改端口的

论坛徽章:
0
5 [报告]
发表于 2005-03-08 10:47 |只看该作者

更改ssh监听端口的问题

[quote]原帖由 "jxwaxqb"]改/etc/services和sshd_config[/quote 发表:

和/etc/services没任何关系
需要找到正确位置的sshd_config,然后修改其端口号,重启sshd服务
因为不同的安装方式,sshd_config的文件位置不同,而且可能不只一个

论坛徽章:
0
6 [报告]
发表于 2005-03-08 10:48 |只看该作者

更改ssh监听端口的问题

[quote]原帖由 "chenzq1604"]还要启动一下sshd服务,对了,你用客户端什么登录如果是putty登录时要修改端口的[/quote 发表:

这个当然是知道的了,就是不行啊。

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
7 [报告]
发表于 2005-03-08 10:50 |只看该作者

更改ssh监听端口的问题

service sshd restart;tail -f /var/log/messages 贴出结果

论坛徽章:
0
8 [报告]
发表于 2005-03-08 10:50 |只看该作者

更改ssh监听端口的问题

重启sshd服务后,netstat -lnp看一下

论坛徽章:
0
9 [报告]
发表于 2005-03-08 17:05 |只看该作者

更改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

论坛徽章:
0
10 [报告]
发表于 2005-03-08 17:27 |只看该作者

更改ssh监听端口的问题

FT,move the "#" of  "#Port 1234 " line ,service sshd restart again……
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP