我在运行 Ubuntu Linux 14.04 的服务器上安装了 ProFTPd 服务。我不知道为什么 ProFTPd 会自动关闭。我有足够的 RAM 和 CPU,我真的不知道为什么会发生这种情况。我还检查了 ProFTPd 配置文件,但还是不明白。
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes, reload proftpd after modifications, if
# it runs in daemon mode. It is not required in inetd/xinetd mode.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 on
# If set on you can experience a longer connection delay in many cases.
IdentLookups off
ServerName "Debian"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"
DenyFilter \*.*/
# Use this to jail all users in their homes
#DefaultRoot ~
# RequireValidShell off
# Port 21 is the standard FTP port.
Port 21
# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534
# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.
# MasqueradeAddress 1.2.3.4
# This is useful for masquerading address with dynamic IPs:
# refresh any configured MasqueradeAddress directives every 8 hours
<IfModule mod_dynmasq.c>
# DynMasqRefresh 28800
</IfModule>
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User proftpd
Group nogroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
# PersistentPasswd off
# This is required to use both PAM-based authentication and local passwords
# AuthOrder mod_auth_pam.c* mod_auth_unix.c
# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
# UseSendFile off
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
# Logging onto /var/log/lastlog is enabled but set to off by default
#UseLastlog on
# In order to keep log file dates consistent after chroot, use timezone info
# from /etc/localtime. If this is not set, and proftpd is configured to
# chroot (e.g. DefaultRoot or <Anonymous>), it will use the non-daylight
# savings timezone regardless of whether DST is in effect.
#SetEnv TZ :/etc/localtime
<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>
<IfModule mod_ratio.c>
Ratios off
</IfModule>
# Delay engine reduces impact of the so-called Timing Attack described in
# http://www.securityfocus.com/bid/11430/discuss
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>
#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf
#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf
#
# Useful to keep VirtualHost/VirtualRoot directives separated
#
#Include /etc/proftpd/virtuals.conf
# A basic anonymous configuration, no upload directories.
# <Anonymous ~ftp>
# User ftp
# Group nogroup
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# # Cosmetic changes, all files belongs to ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
#
# RequireValidShell off
#
# # Limit the maximum number of anonymous logins
# MaxClients 10
#
# # We want 'welcome.msg' displayed at login, and '.message' displayed
# # in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message
#
# # Limit WRITE everywhere in the anonymous chroot
# <Directory *>
# <Limit WRITE>
# DenyAll
# </Limit>
# </Directory>
#
# # Uncomment this if you're brave.
# # <Directory incoming>
# # # Umask 022 is a good standard umask to prevent new files and dirs
# # # (second parm) from being group and world writable.
# # Umask 022 022
# # <Limit READ WRITE>
# # DenyAll
# # </Limit>
# # <Limit STOR>
# # AllowAll
# # </Limit>
# # </Directory>
#
# </Anonymous>
# Include other custom configuration files
Include /etc/proftpd/conf.d/
<Global>
DefaultRoot ~
AllowOverwrite on
</Global>
关于如何防止它自行关闭,您有什么想法吗?
谢谢。
答案1
也许这个评论对你有帮助:
https://stackoverflow.com/a/23666795
该问题是由于 ProFTPD 没有及时停止并重新启动造成的。
解决方法是编辑服务文件,添加重试。
/etc/init.d/proftpd
找到这一行:
start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
更改为此:
start-stop-daemon --stop --signal $SIGNAL --retry 1 --quiet --pidfile "$PIDFILE"
这个改变帮我解决了这个问题。
答案2
我找到了解决这个问题的方法。
不确定它是否是最好的,但对我来说它很有用。
我为 proftpd 服务设置了一个监视器,如果检测到 proftps 已关闭,我将调用 proftpd 启动命令,就是这样。
希望这可以帮助。
答案3
@Adrian 的回答帮助我找到了我需要的东西,但更详细地说明了我做了什么,完全有效。
对我来说关键是我安装了 monit 作为解决方案,它可以监视 proftpd 进程并确保它始终在运行,如果它检测到服务未运行,那么它就会启动它。
第一的
确保先更新并升级
apt-get update
apt-get upgrade
第二
下载并安装监控
apt-get install monit
第三
cd /etc/monit/
vi monitrc
找到注释行set httpd port 2812 and
并取消注释/将其更改为
set httpd port 2812
如果您希望能够不仅从本地主机访问,而是从远程访问,请删除“and”
然后仅取消注释行
allow admin:monit
这是您登录所需的用户身份验证凭据,请根据需要进行更改
然后在文件中添加此内容,我在页面底部添加了我的。更改端口号以匹配您的端口号,否则默认为 21
check process proftpd with pidfile /var/run/proftpd.pid
start program = "/etc/init.d/proftpd start"
stop program = "/etc/init.d/proftpd stop"
if failed port 21 protocol ftp then restart
然后只需重启服务
/etc/init.d/monit restart
你已经完成了...欢迎!这里有一张漂亮的图片,向你展示它是什么样子
您可以从 youripordomain.com:2812 访问 Web 界面
Monit 将不断检查服务,如果未运行,则启动它。对于您想要检查的任何服务来说,这都是一个很棒的工具。
边注
如果您启动时在 monit 中收到“执行失败 | 不存在”状态,则检查以确保 proftpd PID 与 proftpd 的 PID 文件匹配。
首先确保 proftpd 正在运行/etc/init.d/proftpd start
然后top
在终端中输入并找到PID
当前正在运行的 proftpd
转到/var/run/proftpd.PID
并确保该文件中的 PID 与 中的匹配top
。如果不匹配,则在文件中进行更改并重新启动 monit
/etc/init.d/monit restart