Chinaunix

标题: 请问怎么样把ssh从standalone转换成xinetd [打印本页]

作者: wlacf    时间: 2006-09-21 17:48
标题: 请问怎么样把ssh从standalone转换成xinetd
请问openssh默认的启动方式是standalone吗,如果想将其转换成xinetd方式启动,应该要变动哪些地方呢?如果换成xinetd启动后再用service sshd start等同时用对SSH有影响吗?谢谢。
作者: kenduest    时间: 2006-09-21 23:21
原帖由 wlacf 于 2006-9-21 17:48 发表
请问openssh默认的启动方式是standalone吗,如果想将其转换成xinetd方式启动,应该要变动哪些地方呢?


  1. cat /etc/xinetd.d/sshd-xinetd
  2. # default: off
  3. # description: sshd server, xinetd version. \
  4. # Don't run the standalone version if you run \
  5. # this.
  6. service ssh
  7. {
  8.         disable = yes
  9.         socket_type             = stream
  10.         wait                    = no
  11.         user                    = root
  12.         server                  = /usr/sbin/sshd
  13.         server_args             = -i
  14.         log_on_success          += DURATION USERID
  15.         log_on_failure          += USERID
  16.         nice                    = 10
  17. }
复制代码


你需要先设定你原本 standalone sshd 服务停止执行,并设定每次开机不启动,后续即可改用 xinetd 启动之。

如果换成xinetd启动后再用service sshd start等同时用对SSH有影响吗?谢谢。


用 xinetd 了,你在也不可以使用 service sshd start,因为后续都是由 xinetd listen port 22。

==
作者: wlacf    时间: 2006-09-22 11:15
那我系统这个目录下没有这个文件/etc/xinetd.d/sshd-xinetd,是不是要手动创建啊,还有设定原本 standalone sshd 服务停止执行,用service sshd stop行吗,还是用别的方法停止?设定每次开机不启动是这样子吗?chkconfig --level 0123456 sshd off 本人刚学,愚蠢了点,望见谅。呵呵。这样改完后,不用改原来sshd_config的配置文件吗?因为原来的配置文件好像没有启动方式这项,不像别的比如proftpd等有这个选项可选的。如果是这样的话,那原来的standalone启动方式是在哪里设置的呢?谢谢。
作者: kenduest    时间: 2006-09-22 11:54
原帖由 wlacf 于 2006-9-22 11:15 发表
那我系统这个目录下没有这个文件/etc/xinetd.d/sshd-xinetd,是不是要手动创建啊


yes...

还有设定原本 standalone sshd 服务停止执行,用service sshd stop行吗,还是用别的方法停止?


yes... or /etc/init.d/sshd stop

设定每次开机不启动是这样子吗?chkconfig --level 0123456 sshd off


yes... rh-based 系统是可以使用 chkconfig。

不过你用 chkconfig sshd off 就可以了

这样改完后,不用改原来sshd_config的配置文件吗?因为原来的配置文件好像没有启动方式这项,不像别的比如 proftpd等有这个选项可选的。如果是这样的话,那原来的standalone启动方式是在哪里设置的呢?谢谢。


sshd 启动传入 -i 就是使用 inetd/xinetd 方式启动运作之。


  1. man sshd

  2.      -i      Specifies that sshd is being run from inetd(8).  sshd is normally
  3.              not run from inetd because it needs to generate the server key
  4.              before it can respond to the client, and this may take tens of
  5.              seconds.  Clients would have to wait too long if the key was
  6.              regenerated every time.  However, with small key sizes (e.g.,
  7.              512) using sshd from inetd may be feasible.

复制代码


还有,其实 sshd 不要放 xinetd 启动,因为通常实在没这个必要。

==
作者: wlacf    时间: 2006-09-22 12:02
讲得实在是太好了,对我非常有用,万分感激。谢谢




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2