粤ICP备11076303号  广州青年志愿者协会医疗服务总队 www.gzyld.org.cn
加入医疗队
加入志愿者

位置:GZ医疗队公益纪实公益站长网络技术

FreeBSD6.1入门级Web服务器配置手记(4)


来源:落伍者      作者:HarbinBeer      点击:次      时间:2007-06-18



QUOTE:
# ee /etc/rc.conf




[Copy to clipboard] [ - ]CODE:
enable_quotas="YES"
check_quotas="YES"




QUOTE:
# ee /etc/fstab




[Copy to clipboard] [ - ]CODE:
/dev/ad0s1f /usr ufs rw,userquota,groupquota 2 2




QUOTE:
# quotacheck -av
# repquota –a
# edquota –u ftpuser




[Copy to clipboard] [ - ]CODE:
/usr: kbytes in use: 0, limits (soft = 100000, hard = 100020) # soft是警告容量,hard是强制容量




QUOTE:
# edquota –t




[Copy to clipboard] [ - ]CODE:
/usr: block grace period: 1 minutes, file grace period: 1 minutes




QUOTE:
# quotaon -a

安装pure-ftpd(推荐)


QUOTE:
# pw groupadd ftpgroup -g 10001
# pw useradd ftp -u 10001 -g ftpgroup -s /sbin/nologin
# chown ftp:ftpgroup /usr/www
# cd /usr/ports/ftp/pure-ftpd
# ee Makefile




[Copy to clipboard] [ - ]CODE:
CONFIGURE_ARGS = --without-standalone # 为将来以守护进程模式运行准备(可选)




QUOTE:
# make install clean

选择MYSQL,PAM,PRIVSEP,PERUSERLIMITS,THROTTLING,BANNER,UPLOADSCRIPT,SENDFILE

建立pure-ftpd数据库
通过phpmyadmin执行


[Copy to clipboard] [ - ]CODE:
CREATE DATABASE pureftpd;
USE pureftpd;
CREATE TABLE `users` (
`User` varchar(16) NOT NULL default '',
`Password` varchar(32) binary NOT NULL default '',
`Uid` int(11) NOT NULL default '14',
`Gid` int(11) NOT NULL default '5',
`Dir` varchar(128) NOT NULL default '',
`QuotaFiles` int(10) NOT NULL default '500',
`QuotaSize` int(10) NOT NULL default '30',
`ULBandwidth` int(10) NOT NULL default '80',
`DLBandwidth` int(10) NOT NULL default '80',
`ipaccess` varchar(15) NOT NULL default '*',
`Comment` tinytext,
`Status` enum('0','1') NOT NULL default '1',
`ULRatio` smallint(5) NOT NULL default '1',
`DLRatio` smallint(5) NOT NULL default '1',
PRIMARY KEY (`User`),
UNIQUE KEY `User` (`User`)
) TYPE=MyISAM;

通过phpmyadmin新建一用户名为ftpadmin,密码adminpassword,并赋予其pureftpd数据库的Select,Insert,Update,Delete权限。

配置pure-ftp


QUOTE:
# cd /usr/local/etc
# cp pureftpd-mysql.conf.sample pureftpd-mysql.conf
# ee pureftpd-mysql.conf




[Copy to clipboard] [ - ]CODE:
# 具体选项请参考http://download.pureftpd.org/pub/pure-ftpd/doc/README
MYSQLServer localhost
MYSQLUser ftpadmin
MYSQLPassword adminpassword
MYSQLDatabase pureftpd
MYSQLCrypt crypt
MYSQLGetPW SELECT Password FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MYSQLGetUID SELECT Uid FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MYSQLGetGID SELECT Gid FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MYSQLGetDir SELECT Dir FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaccess = "*" OR Ipaccess LIKE "\R")

如果以standalone(独立进程)方式运行,还需要编辑pure-ftpd的配置文件


QUOTE:
# cp pureftpd.conf.sample pure-ftpd.conf
# ee pure-ftpd.conf

让pure-ftpd随系统启动

如果以inetd(守护进程)方式运行


QUOTE:
# ee /etc/rc.conf




[Copy to clipboard] [ - ]CODE:
inetd_enable=”YES”




QUOTE:
# ee /etc/inetd.conf




[Copy to clipboard] [ - ]CODE:
# 详细启动参数请参考http://download.pureftpd.org/pub/pure-ftpd/doc/README
新活动 回顶部
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片
最新评论 进入详细评论页>>