这是51cto分享过来的,我要根据这边文章做一个centos系统的试试
pw groupadd ftpusers -g 1001
pw adduser ftpusers -u 1001 -g ftpusers -d /usr/www -s /sbin/nologin
chown ftpusers:ftpusers /usr/www
##其中用户、组、/usr/www等可根据自己的实际情况选择
tar jxvf pure-ftpd-1.0.20.tar.bz2
cd pure-ftpd-1.0.20
./configure --prefix=/usr/local/pureftpd --with-mysql --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-altlog --with-language=simplified-chinese
make
make install
#########################################
以前用pureftpd的时候还不知道最好用ports安装,所以一直自己编译安装,现在要装,最好用ports安装。
cd /usr/ports/ftp/pure-ftpd
ee Makefile
改成这样就行了:
CODE:
[Copy to clipboard]
CONFIGURE_ARGS= --with-everything \
--with-paranoidmsg \
--with-virtualchroot \
--with-tls \
--with-largefile \
--sysconfdir=${PREFIX}/etc然后make install clean即可。
注:多谢benbenblood 兄提示,原来写的不够清楚,容易误导大家 http://bbs.chinaunix.net/images/smilies/em06.gif
######################################
mkdir /usr/local/pureftpd/etc
cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl
chmod u+x /usr/local/pureftpd/sbin/pure-config.pl
ee /usr/local/pureftpd/etc/pure-ftpd.conf
可参考其他文章进行设置,需要注意的是:
BrokenClientsCompatibility YES
#如果不设置的话,用IE登陆时.ftpquota会不计数,用户的磁盘配额将不起作用。
# MySQL configuration file (see README.MySQL)
# pureftpd-mysql.conf文件的位置
MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
##这个文件的地方一定要写对
2:安装pureftpd_php_manager
tar zxvf pureftpd_php_manager.tar.gz
cp -R pureftpd_php_manager /usr/www/phpmanager
#或者直接mv,/usr/www目录为apache的主目录,如果不同请更换
find /usr/www/phpmanager -type d -exec chmod 755 {} \;
find /usr/www/phpmanager -type f -exec chmod 644 {} \;
cd /usr/www/phpmanager/
cp pureftpd-mysql.conf.sample /usr/local/pureftpd/etc/pureftpd-mysql.conf
ee /usr/local/pureftpd/etc/pureftpd-mysql.conf
#MYSQLSocket /var/lib/mysql/mysql.sock
MYSQLServer localhost
MYSQLPort 3306
MYSQLUser pureftpd
##注意此处的用户要和后面在数据库中添加的一致
MYSQLPassword abcdefg
##注意此处的密码要和后面在数据库中添加的一致
MYSQLDatabase pureftpd
##注意此处的数据库名字要和后面在数据库中添加的一致
MYSQLCrypt md5
##如果是默认的pureftpd_php_manager则不能用md5,要用crypt或者cleartext,不管是crypt还是cleartext都要和后面的一致
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
###############################################
ee /usr/www/phpmanager/pureftp.config.php
;
mysql -u root -p
mysql>;
drop database pureftpd;
CREATE DATABASE pureftpd;
use pureftpd;
DROP TABLE IF EXISTS ftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(12http://bbs.chinaunix.net/images/smilies/icon_cool.gif NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
grant all privileges on pureftpd.* to pureftpd@localhost identified by 'abcdefg';
##grant all privileges on 你刚建立的数据库名称.* to 你要建的mysql用户名称@localhost identified by 'mysql新用户密码'
FLUSH PRIVILEGES;
##重载受权表
3:启动pureftpd
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
为了以后方便的进行Ftp服务的管理,我自己在/usr/local/etc/rc.d中新建了一个pureftpd.sh文件。
ee /usr/local/etc/rc.d/pureftpd.sh
#!/bin/sh
case "$1" in
start)
if [ -f /usr/local/pureftpd/etc/pure-ftpd.conf ]; then
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf >; /dev/null 2>;&1 && echo -n 'pure-ftpd Begin!'
fi
;;
stop)
/usr/bin/killall pure-ftpd >; /dev/null 2>;&1 && echo -n 'pure-ftpd Stop!'
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac
设置该文件的可执行权限
chmod u+x /usr/local/etc/rc.d/pureftpd.sh
以后可以用下列命令启动PureFTPd服务
/usr/local/etc/rc.d/pureftpd.sh start
用下列命令停止PureFTPd服务
/usr/local/etc/rc.d/pureftpd.sh stop
让它开机自动启动,在/etc/rc.conf里面加入pureftpd_enable="YES"或者不加也可以。
4:web界面管理
安装了pureftpd_php_manager以后就可以通过http://你的域名或ip/phpmanager/index.php来添加、删除用户了。[/code]
要下载pureftpd_php_manager.tar.gz,请在下面没有显示出的图片上点鼠标右键,将那个链接复制,用flashget、迅雷等软件下载,把后面的.jpg去掉即可。
pw groupadd ftpusers -g 1001
pw adduser ftpusers -u 1001 -g ftpusers -d /usr/www -s /sbin/nologin
chown ftpusers:ftpusers /usr/www
##其中用户、组、/usr/www等可根据自己的实际情况选择
tar jxvf pure-ftpd-1.0.20.tar.bz2
cd pure-ftpd-1.0.20
./configure --prefix=/usr/local/pureftpd --with-mysql --with-paranoidmsg --with-shadow --with-welcomemsg --with-uploadscript --with-quotas --with-cookie --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-throttling --with-altlog --with-language=simplified-chinese
make
make install
#########################################
以前用pureftpd的时候还不知道最好用ports安装,所以一直自己编译安装,现在要装,最好用ports安装。
cd /usr/ports/ftp/pure-ftpd
ee Makefile
改成这样就行了:
CODE:
[Copy to clipboard]
CONFIGURE_ARGS= --with-everything \
--with-paranoidmsg \
--with-virtualchroot \
--with-tls \
--with-largefile \
--sysconfdir=${PREFIX}/etc然后make install clean即可。
注:多谢benbenblood 兄提示,原来写的不够清楚,容易误导大家 http://bbs.chinaunix.net/images/smilies/em06.gif
######################################
mkdir /usr/local/pureftpd/etc
cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl
chmod u+x /usr/local/pureftpd/sbin/pure-config.pl
ee /usr/local/pureftpd/etc/pure-ftpd.conf
可参考其他文章进行设置,需要注意的是:
BrokenClientsCompatibility YES
#如果不设置的话,用IE登陆时.ftpquota会不计数,用户的磁盘配额将不起作用。
# MySQL configuration file (see README.MySQL)
# pureftpd-mysql.conf文件的位置
MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
##这个文件的地方一定要写对
2:安装pureftpd_php_manager
tar zxvf pureftpd_php_manager.tar.gz
cp -R pureftpd_php_manager /usr/www/phpmanager
#或者直接mv,/usr/www目录为apache的主目录,如果不同请更换
find /usr/www/phpmanager -type d -exec chmod 755 {} \;
find /usr/www/phpmanager -type f -exec chmod 644 {} \;
cd /usr/www/phpmanager/
cp pureftpd-mysql.conf.sample /usr/local/pureftpd/etc/pureftpd-mysql.conf
ee /usr/local/pureftpd/etc/pureftpd-mysql.conf
#MYSQLSocket /var/lib/mysql/mysql.sock
MYSQLServer localhost
MYSQLPort 3306
MYSQLUser pureftpd
##注意此处的用户要和后面在数据库中添加的一致
MYSQLPassword abcdefg
##注意此处的密码要和后面在数据库中添加的一致
MYSQLDatabase pureftpd
##注意此处的数据库名字要和后面在数据库中添加的一致
MYSQLCrypt md5
##如果是默认的pureftpd_php_manager则不能用md5,要用crypt或者cleartext,不管是crypt还是cleartext都要和后面的一致
MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R"http://bbs.chinaunix.net/images/smilies/icon_wink.gif
###############################################
ee /usr/www/phpmanager/pureftp.config.php
;
mysql -u root -p
mysql>;
drop database pureftpd;
CREATE DATABASE pureftpd;
use pureftpd;
DROP TABLE IF EXISTS ftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(12http://bbs.chinaunix.net/images/smilies/icon_cool.gif NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
grant all privileges on pureftpd.* to pureftpd@localhost identified by 'abcdefg';
##grant all privileges on 你刚建立的数据库名称.* to 你要建的mysql用户名称@localhost identified by 'mysql新用户密码'
FLUSH PRIVILEGES;
##重载受权表
3:启动pureftpd
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf
为了以后方便的进行Ftp服务的管理,我自己在/usr/local/etc/rc.d中新建了一个pureftpd.sh文件。
ee /usr/local/etc/rc.d/pureftpd.sh
#!/bin/sh
case "$1" in
start)
if [ -f /usr/local/pureftpd/etc/pure-ftpd.conf ]; then
/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf >; /dev/null 2>;&1 && echo -n 'pure-ftpd Begin!'
fi
;;
stop)
/usr/bin/killall pure-ftpd >; /dev/null 2>;&1 && echo -n 'pure-ftpd Stop!'
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac
设置该文件的可执行权限
chmod u+x /usr/local/etc/rc.d/pureftpd.sh
以后可以用下列命令启动PureFTPd服务
/usr/local/etc/rc.d/pureftpd.sh start
用下列命令停止PureFTPd服务
/usr/local/etc/rc.d/pureftpd.sh stop
让它开机自动启动,在/etc/rc.conf里面加入pureftpd_enable="YES"或者不加也可以。
4:web界面管理
安装了pureftpd_php_manager以后就可以通过http://你的域名或ip/phpmanager/index.php来添加、删除用户了。[/code]
要下载pureftpd_php_manager.tar.gz,请在下面没有显示出的图片上点鼠标右键,将那个链接复制,用flashget、迅雷等软件下载,把后面的.jpg去掉即可。
编辑回复