我有 2 个 FTP 服务器,主要使用端口 2222 上的 sFTP 和端口 21 上的 FTP。在 ProFTPd 系统之上,我运行一个 proftpd_admin 工具:proftpd-admin 链接1
它为用户使用 MySQL 后端。但事实证明,端口 2222 上的 sFTP 使用此用户数据库,但 FTP 部分使用本地系统帐户访问服务器。
我想使用相同的 MySQL 数据库来提供这两种服务。我在 proftpd.conf 的全局部分中添加了 SQL 部分,并且定义了 sftp 服务。
在虚拟服务器中我定义了FTP服务,但是当我添加加载模块mysql时它通常无法启动......
您对我在哪里以及如何在虚拟服务器中为 ftp 服务定义 mysql 用法有什么建议吗?
谢谢。
[编辑] PS这是我的proftpd.conf
ServerName "Some FTP Delivery server"
ServerIdent on "FTP Server ready."
ServerAdmin root@localhost
DefaultServer on
DefaultAddress 372.124.444.395
DefaultRoot ~ !adm
TimeoutIdle 300
TimeoutNoTransfer 600
UseIPv6 off
#AuthPAMConfig proftpd
UseReverseDNS off
User nobody
Group nobody
MaxInstances 100
RequireValidShell off
AllowForeignAddress on
AllowRetrieveRestart on
AllowStoreRestart on
UseSendfile off
Umask 000 000
PassivePorts 65100 65199
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LogFormat write "%h %l %u %t \"%r\" %s %b"
TransferLog /var/log/proftpd/xfer.log
ExtendedLog /var/log/proftpd/auth.log AUTH auth
AuthOrder mod_sql.c
# Modules to load section.
LoadModule mod_ctrls_admin.c
LoadModule mod_vroot.c
LoadModule mod_sftp.c
#LoadModule mod_sftp_sql.c
LoadModule mod_sql.c
LoadModule mod_sql_mysql.c
LoadModule mod_quotatab.c
LoadModule mod_quotatab_sql.c
LoadModule mod_wrap.c
LoadModule mod_rewrite.c
LoadModule mod_shaper.c
LoadModule mod_ifsession.c
ModuleControlsACLs insmod,rmmod allow user root
ModuleControlsACLs lsmod allow user *
ControlsEngine on
ControlsACLs all allow user root
ControlsSocketACL allow user *
ControlsLog /var/log/proftpd/controls.log
<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
AdminControlsACLs all allow user root
</IfModule>
<IfModule mod_vroot.c>
VRootEngine on
</IfModule>
<IfDefine TLS>
TLSEngine on
TLSRequired on
TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem
TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem
TLSCipherSuite ALL:!ADH:!DES
TLSOptions NoCertRequest
TLSVerifyClient off
TLSLog /var/log/proftpd/tls.log
<IfModule mod_tls_shmcache.c>
TLSSessionCache shm:/file=/var/run/proftpd/sesscache
</IfModule>
</IfDefine>
/etc/sysconfig/proftpd
<IfDefine DYNAMIC_BAN_LISTS>
LoadModule mod_ban.c
BanEngine on
BanLog /var/log/proftpd/ban.log
BanTable /var/run/proftpd/ban.tab
BanOnEvent MaxLoginAttempts 2/00:10:00 01:00:00
BanMessage "Host %a has been banned"
BanControlsACLs all allow user ftpadm
</IfDefine>
# Set networking-specific "Quality of Service" (QoS) bits on the
packets used
# by the server (contrib/mod_qos.html)
<IfDefine QOS>
LoadModule mod_qos.c
# RFC791 TOS parameter compatibility
QoSOptions dataqos throughput ctrlqos lowdelay
# For a DSCP environment (may require tweaking)
#QoSOptions dataqos CS2 ctrlqos AF41
</IfDefine>
<Global>
AllowOverwrite yes
<Limit ALL SITE_CHMOD>
AllowAll
#DenyAll
</Limit>
ShowSymlinks on
<IfModule mod_sql.c>
SQLBackend mysql
SQLAuthTypes Backend
SQLConnectInfo [email protected] proftpd proftpd
SQLUserInfo usertable userid passwd uid gid
homedir shell
SQLGroupInfo grouptable groupname gid members
SQLUserWhereClause "disabled=0 and (NOW()<=expiration
or expiration=-1 or expiration=0)"
SQLLog PASS counter
SQLNamedQuery counter UPDATE "lastlogin=now(), count=count+1 WHERE
userid='%u'" usertable
SQLLog EXIT time_logout
SQLNamedQuery time_logout UPDATE "lastlogout=now() WHERE
userid='%u'" usertable
SQLNamedQuery login_time SELECT "lastlogin from usertable where
userid='%u'"
#SQLShowInfo PASS "230" "Last login was: %{login_time}"
SQLLog RETR,STOR transfer1
SQLNamedQuery transfer1 INSERT "'%u', '%f', '%b', '%h', '%a',
'%m', '%T', now(), 'c', NULL" xfer_stat
SQLLog ERR_RETR,ERR_STOR transfer2
SQLNamedQuery transfer2 INSERT "'%u', '%f', '%b', '%h', '%a',
'%m', '%T', now(), 'i', NULL" xfer_stat
</IfModule>
<IfModule mod_quotatab.c>
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaOptions ScanOnLogin
QuotaLog /var/log/proftpd/quota.log
SQLNamedQuery get-quota-limit SELECT "name, quota_type,
per_session, limit_type, bytes_in_avail, bytes_out_avail,
bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail
FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type,
bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used,
files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%
{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used =
bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1},
bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used =
files_in_used + %{3}, files_out_used = files_out_used + %{4},
files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND
quota_type = '%{7}'" ftpquotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %
{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-
quota-tally
</IfModule>
</Global>
<IfModule mod_sftp.c>
SFTPEngine on
Port 2222
SFTPLog /var/log/proftpd/sftp.log
SFTPAuthMethods password #publickey
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPHostKey /etc/ssh/ssh_host_rsa_key
</IfModule>
#<VirtualHost 172.23.54.195>
# port 21
# DefaultRoot ~ !admins
# MaxClientsPerHost 25 "Sorry, no more!"
# MaxClients 50 "Sorry, too much users.."
#</VirtualHost>
Include /etc/proftpd/classes.conf
Include /etc/proftpd/groups.conf
Include /etc/proftpd/shaper.conf
Include /etc/proftpd/limits.conf
Include /etc/proftpd/virtuals.conf