发现网上很多兄弟都在为安装proftpd+mysql+quota的种种问题苦恼。
我就整理一下我的安装过程,当然也不是原创了。也提供了相关软件包永久下载
,mysql/php/apache安装就免了。我的mysql是使用源码安装!
相关软件:
---------------------------------------------------------------
[url=http://www.181info.com/proftpd/proftpd-1.2.9.tar.gz]proftpd-1.2.9.tar.gz[/url]
[url=http://www.181info.com/proftpd/proftpd-mod-quotatab-1.2.11.tar.gz]proftpd-mod-quotatab-1.2.11.tar.gz[/url]
[url=http://www.181info.com/proftpd/ftpdb.sql]ftpdb.sql[/url]
[url=http://www.181info.com/proftpd/proftpd.conf]proftpd.conf[/url]
---------------------------------------------------------------
步骤如下:
[code:1:83e788a4d2]
vi /etc/ld.so.conf
添加:/usr/local/mysql/lib
tar zvxf proftpd-1.2.9.tar.gz
tar zvxf proftpd-mod-quotatab-1.2.11.tar.gz
cp mod_quotatab/*.c proftpd-1.2.9/contrib/
cp mod_quotatab/*.h proftpd-1.2.9/contrib/
vi proftpd-1.2.9/contrib/mod_sql_mysql.c
#include</usr/local/mysql/include/mysql.h>
修改mysql.h的实际路径
cd proftpd-1.2.9
./configure \--prefix=/usr/local/proftpd \--with-modules=mod_sql:mod_sql_mysql:mod_quotatab\:mod_quotatab_sql:mod_ratio \--with-includes=/usr/local/mysql/include \--with-libraries=/usr/local/mysql/lib
make
make install
cp proftpd-1.2.9/contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
vi /etc/rc.d/init.d/proftpd
修改:PATH="$PATH:/usr/local/proftpd/sbin"
chmod 755 /etc/rc.d/init.d/proftpd
chkconfig --level 3 proftpd on
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
然后配置你的Proftpd.conf
最后就是启动啦。/usr/local/proftpd/sbin/proftpd
[/code:1:83e788a4d2]
-------------------------------Proftpd.conf----------------------------------
[code:1:83e788a4d2]
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName "ltsnet"
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# 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 under which the server will run.
User nobody
Group nobody
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
ServerIdent off
DisplayLogin welcome.msg
DefaultRoot ~
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite on
</Directory>
# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
<Anonymous /home/ftp>
User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
# 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
DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
SQLAuthTypes Backend Plaintext
SQLAuthenticate users* groups*
SQLConnectInfo ftpdb@localhost root 123456
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
SQLHomedirOnDemand on
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaLog "/var/log/quota"
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
[/code:1:83e788a4d2]
建ftpdb库,在phpMyAdmin中导入ftpdb.sql就ok。
--------------------------------------ftpdb.sql---------------------------------
[code:1:83e788a4d2]
# 表的结构 `ftpgroup`
#
CREATE TABLE `ftpgroup` (
`groupname` varchar(16) NOT NULL default '',
`gid` smallint(6) NOT NULL default '5500',
`members` varchar(16) NOT NULL default '',
KEY `groupname` (`groupname`)
) TYPE=MyISAM COMMENT='ProFTP group table';
#
# 导出表中的数据 `ftpgroup`
#
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
# --------------------------------------------------------
#
# 表的结构 `ftpquotalimits`
#
CREATE TABLE `ftpquotalimits` (
`name` varchar(30) default NULL,
`quota_type` enum('user','group','class','all') NOT NULL default 'user',
`per_session` enum('false','true') NOT NULL default 'false',
`limit_type` enum('soft','hard') NOT NULL default 'soft',
`bytes_in_avail` float NOT NULL default '0',
`bytes_out_avail` float NOT NULL default '0',
`bytes_xfer_avail` float NOT NULL default '0',
`files_in_avail` int(10) unsigned NOT NULL default '0',
`files_out_avail` int(10) unsigned NOT NULL default '0',
`files_xfer_avail` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
#
# 导出表中的数据 `ftpquotalimits`
#
INSERT INTO `ftpquotalimits` VALUES ('test', 'user', 'true', 'hard', '9e+06', '2000', '9e+09', 2000, 2000, 2000);
# --------------------------------------------------------
#
# 表的结构 `ftpquotatallies`
#
CREATE TABLE `ftpquotatallies` (
`name` varchar(30) NOT NULL default '',
`quota_type` enum('user','group','class','all') NOT NULL default 'user',
`bytes_in_used` float NOT NULL default '0',
`bytes_out_used` float NOT NULL default '0',
`bytes_xfer_used` float NOT NULL default '0',
`files_in_used` int(10) unsigned NOT NULL default '0',
`files_out_used` int(10) unsigned NOT NULL default '0',
`files_xfer_used` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
#
# 导出表中的数据 `ftpquotatallies`
#
INSERT INTO `ftpquotatallies` VALUES ('test', 'user', '2000', '2000', '2000', 2000, 2000, 2000);
# --------------------------------------------------------
#
# 表的结构 `ftpuser`
#
CREATE TABLE `ftpuser` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` varchar(32) NOT NULL default '',
`passwd` varchar(32) NOT NULL default '',
`uid` smallint(6) NOT NULL default '5500',
`gid` smallint(6) NOT NULL default '5500',
`homedir` varchar(255) NOT NULL default '',
`shell` varchar(16) NOT NULL default '/sbin/nologin',
`count` int(11) NOT NULL default '0',
`accessed` datetime NOT NULL default '0000-00-00 00:00:00',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='ProFTP user table' AUTO_INCREMENT=3 ;
#
# 导出表中的数据 `ftpuser`
#
INSERT INTO `ftpuser` VALUES (1, 'test', '123456', 5500, 5500, '/home/test', '/sbin/nologin', 36, '2004-09-28 13:07:41', '2004-09-28 13:07:42');
[/code:1:83e788a4d2]
quotalimits表
[code:1:83e788a4d2]
name: - 用户帐号
quota type: - user, group, class, all (we use user)
per_session: - true or false (we use true)
limit_type: - 硬限制 or 软限制 (我们一般用硬限制)
bytes_in_avail: - 允许上传的字节数
bytes_out_avail: - 允许下载的字节数
bytes_xfer_avail: - 允许传输的字节数(包括上传/下载)
files_in_avail: - 允许上传的文件数
files_out_avail: - 允许下载的文件数
files_xfer_avail: - 允许传输的文件数(包括上传/下载)
[/code:1:83e788a4d2]
按这些步骤来安装,应该没问题。老实说用mysql和quota模块来验证用户和设置磁盘限额,但我总觉得还是不够完善,因为在这个方法中,数据库表里还没有相应的权限的字段,所以说相应用户的权限还是得用实际得用户即mysql对应得uid和gid来控制权限,那天要是mysql数据库也能完全控制权限就好了。
phpcool 回复于:2004-10-13 11:46:16 |
proftpd-1.2.10以上版本就不需要proftpd-mod-quotatab-1.2.11.tar.gz 插件. |
落伍者 回复于:2004-10-14 09:21:17 |
/usr/local/mysql-standard-4.0.18-pc-linux-i686/lib/libmysqlclient.a(my_compress.o)(.text+0xb4): In function `my_compress_alloc':
: undefined reference to `compress' /usr/local/mysql-standard-4.0.18-pc-linux-i686/lib/libmysqlclient.a(my_compress.o)(.text+0x12a): In function `my_uncompress': : undefined reference to `uncompress' collect2: ld returned 1 exit status make: *** [proftpd] Error 1 按照你的方法安装还是出现如上提示。什么原因呢?mysql的原因 ? |
phpcool 回复于:2004-10-14 11:11:09 |
--with-includes=/usr/local/mysql/include \--with-libraries=/usr/local/mysql/lib
这俩个路径都要根据自己mysql安装来定。 确认后cp /usr/local/mysql/lib/* /usr/lib |
落伍者 回复于:2004-10-15 10:02:00 |
cp lib文件至/usr/lib了。不行。 |
phpcool 回复于:2004-10-15 10:45:10 |
估计你的Mysql没有装好。以下是我的安装步骤:
[code:1:8f1a52b3a8] 安装MYSQL---------------------------------------------------------------- shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local shell> gunzip < /home/soft/phpsoft/mysql-standard-4.0.21-pc-linux-i686.tar.gz | tar xvf - shell> ln -s mysql-standard-4.0.21-pc-linux-i686 mysql shell> cd mysql shell> scripts/mysql_install_db shell> chown -R root . shell> chown -R mysql data shell> chgrp -R mysql . 启动mysql /etc/rc.d/rc.local shell> /bin/mysqld_safe --user=mysql & [/code:1:8f1a52b3a8] |
donyad 回复于:2004-10-16 09:01:00 |
rpm装的mysql呢? |
xiadfei 回复于:2004-10-17 07:34:58 |
我用的就是这样的系统,但是发现用户使用FLASHGET这样的多线程下载工具的时候QUOTA就会出问题,根本算不出总数来,请问这个问题有办法解决吗? |
superpcman 回复于:2004-11-08 18:03:14 |
[quote:29267e0322="donyad"]rpm装的mysql呢?[/quote:29267e0322]
redhat linux的在/usr/lib/mysql,/usr/include/mysql |
lusec3 回复于:2004-11-10 16:56:02 |
楼主,我现在按你的配置了。启动proftpd后,登陆失败。
Name (localhost:root): test 331 Password required for test. Password: 530 Login incorrect. Login failed. 421 Service not available, remote server has closed connection ftp> 登陆会失败,然后我查看日志记录 shell > tail -f message 查看记录为 Nov 10 16:45:22 proxyserver proftpd[2169]: proxyserver (proxyserver[127.0.0.1]) - FTP session opened. Nov 10 16:45:25 proxyserver proftpd[2169]: proxyserver (proxyserver[127.0.0.1]) - no such user 'ftpgroup' Nov 10 16:45:25 proxyserver proftpd[2169]: proxyserver (proxyserver[127.0.0.1]) - avit chroot("~ftpgroup/"): No such file or directory 我已经增加了用户组 shell>> groupadd -g 5500 ftpgroup shell >> adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser 我的数据库表记录里面已经增加了 mysql> select * from ftpuser; +----+--------+--------+------+------+------------+---------------+-------+---------------------+---------------------+ | id | userid | passwd | uid | gid | homedir | shell | count | accessed | modified | +----+--------+--------+------+------+------------+---------------+-------+---------------------+---------------------+ | 1 | test | test | 5500 | 5500 | /home/test| /sbin/nologin | 0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | +----+--------+--------+------+------+------------+---------------+-------+---------------------+---------------------+ mysql> select * from ftpgroup; +-----------+------+---------+ | groupname | gid | members | +-----------+------+---------+ | ftpgroup | 5500 | ftpuser | +-----------+------+---------+ 我的配置文件 vi proftpd.confUser nobody Group nobody # To cause every FTP user to be "jailed" (chrooted) into their home # directory, uncomment this line. #DefaultRoot ~ TimeoutStalled 10 MaxHostsPerUser 5 "Sorry,you may not connect more than five time." MaxClientsPerUser 5 "Only five such user at a time." MaxClientsPerHost 5 "Sorry,you may not connect more than one time." WtmpLog on TimeoutIdle 600 RootLogin off RequireValidShell off TimeoutStalled 10 MaxClients 10 AllowForeignAddress on AllowStoreRestart on ServerIdent off DefaultRoot ~ftpgroup SQLAuthTypes Backend Plaintext #Plaintext SQLAuthenticate users* groups* SQLConnectInfo ftpdb@localhost root underavit SQLUserInfo ftpuser userid passwd uid gid homedir shell SQLGroupInfo ftpgroup groupname gid members SQLHomedirOnDemand on #Update count every time user logs in SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid ='%u'" ftpuser #Update modified everytime user uploads or deletes a file SQLLog STORE,DELE modified SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser QuotaEngine on QuotaDirectoryTally on QuotaDisplayUnits Mb QuotaShowQuotas on QuotaLog "/var/log/quota" 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,fil es_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+i%{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 DisplayLogin welcome.msg DisplayFirstChdir .message 请问楼主是什么原因导致这种错误。这里先谢了! |
linuxxx 回复于:2004-11-10 23:00:03 |
无法下载啊 |
aodi 回复于:2005-03-01 09:15:43 |
安装环境:rh4 profpt 1.2.9 mysql 4.1.7(rh4自带)
执行前面全部按照 http://bbs.chinaunix.net/forum/viewtopic.php?t=423609 这个帖子的方法安装,没有出现问题 到make install 时出现以下问题! [quote:611d4f24ea] gcc -d linux -i .. -i .. /include -i/usr/include/mysql/ -o 2 -wall -c mod_sql_mysql.c mod_sql_mysql.c:in function cmd_checkauth too many argunments to function 'make_scrambled_password' make[1]:***[mod_sql_mysql.c] 错误1 make[2]:leaving directory '/usr/local/proftp/modules' 错误2 [/quote:611d4f24ea] 在线等待!希望能够得到各位老师的帮助! |
sc782020 回复于:2005-03-31 16:25:18 |
proftpd-1.2.10以上如果不需要quota插件的话,应该怎么安装?怎么限制磁盘空间呢? |
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/
领测软件测试网最新更新
关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073