我正在尝试使用 xinetd 启动服务 vsftpd 和 sshd。我的配置文件如下。
/etc/xinetd.conf
defaults { instances = 60 log_type = FILE /var/log/xinetdlog log_on_success = HOST PID log_on_failure = HOST cps = 25 30 only_from = localhost } includedir /etc/xinetd.d
/etc/xinetd.d/ftp
service ftp { disable = no server = /usr/sbin/vsftpd server_args = -l user = root socket_type = stream protocol = tcp wait = no instances = 4 flags = REUSE nice = 10 log_on_success += DURATION HOST USERID only_from = 127.0.0.1 10.0.0.0/24 }
ssh 的 /etc/xinetd.d/ssh
service ssh { disable = no log_on_failure += USERID server = /usr/sbin/sshd user = root socket_type = stream protocol = tcp wait = no instances = 20 flags = REUSE only_from = 127.0.0.1 10.0.0.0/24 }
尽管我已包含 only_from 属性,vsftp 服务器以及 ssh 服务器仍拒绝来自 localhost 的连接。当我使用“service vsftpd start”和“service ssh start”检查时,vsftp 和 ssh 服务器单独运行良好。当我通过终端使用“xinetd -d”进行调试时,我得到的输出为
13/10/20@00:06:08: DEBUG: 3592 {cnf_start_services} Started service: ftp
13/10/20@00:06:08: DEBUG: 3592 {cnf_start_services} Started service: ssh
13/10/20@00:06:08: DEBUG: 3592 {cnf_start_services} mask_max = 8, services_started = 2
13/10/20@00:06:08: NOTICE: 3592 {main} xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
13/10/20@00:06:08: NOTICE: 3592 {main} Started working: 2 available services
13/10/20@00:06:08: DEBUG: 3592 {main_loop} active_services = 2
13/10/20@00:06:16: DEBUG: 3592 {main_loop} select returned 1
13/10/20@00:06:16: DEBUG: 3592 {server_start} Starting service ftp
13/10/20@00:06:16: DEBUG: 3592 {main_loop} active_services = 2
13/10/20@00:06:16: DEBUG: 3607 {exec_server} duping 9
13/10/20@00:06:16: DEBUG: 3592 {main_loop} active_services = 2
13/10/20@00:06:16: DEBUG: 3592 {main_loop} select returned 1
13/10/20@00:06:16: DEBUG: 3592 {check_pipe} Got signal 17 (Child exited)
13/10/20@00:06:16: DEBUG: 3592 {child_exit} waitpid returned = 3607
13/10/20@00:06:16: DEBUG: 3592 {server_end} ftp server 3607 exited
13/10/20@00:06:16: DEBUG: 3592 {svc_postmortem} Checking log size of ftp service
13/10/20@00:06:16: INFO: 3592 {conn_free} freeing connection
13/10/20@00:06:16: DEBUG: 3592 {child_exit} waitpid returned = -1
两项服务均已启动,但均未运行。
敲了 3-4 个小时后,我仍然不知道这个错误。任何帮助都将不胜感激。谢谢!
答案1
这信号(7)手册页说:
Signal Value Action Comment --------------------------------------------------------- SIGCHLD 20,17,18 Ign Child stopped or terminated
这意味着每当子进程停止时vsftpd或者sshd,父级 -xinetd- 接收信号 17(默认情况下会被忽略,但在您的情况下不会)。
你还需要开始sshd和-i
:
-我
指定 sshd 从 inetd(8) 运行。sshd 通常不从 inetd 运行,因为它需要生成服务器密钥才能响应客户端,这可能需要数十秒。如果每次都重新生成密钥,客户端将不得不等待太长时间。但是,如果密钥大小较小(例如 512),则从 inetd 使用 sshd 可能是可行的。
我不知道vsftpd您正在使用的版本,但是vsftpd-2.2.2-6.el6_0.1如果我设置的话就可以正常listen=NO
工作/etc/vsftpd/vsftpd.conf并且不带任何参数运行它。