📄 1472.html
字号:
以上建立了FTP用户和用户组的数据表。<br>
4.2 建立磁盘限额数据表<br>
CREATE TABLE quotalimits (<br>
name VARCHAR(30),<br>
quota_type ENUM("user", "group", "class", "all") NOT NULL,<br>
per_session ENUM("false", "true") NOT NULL,<br>
limit_type ENUM("soft", "hard") NOT NULL,<br>
bytes_in_avail FLOAT NOT NULL,<br>
bytes_out_avail FLOAT NOT NULL,<br>
bytes_xfer_avail FLOAT NOT NULL,<br>
files_in_avail INT UNSIGNED NOT NULL,<br>
files_out_avail INT UNSIGNED NOT NULL,<br>
files_xfer_avail INT UNSIGNED NOT NULL<br>
);<br>
CREATE TABLE quotatallies (<br>
name VARCHAR(30) NOT NULL,<br>
quota_type ENUM("user", "group", "class", "all") NOT NULL,<br>
bytes_in_used FLOAT NOT NULL,<br>
bytes_out_used FLOAT NOT NULL,<br>
bytes_xfer_used FLOAT NOT NULL,<br>
files_in_used INT UNSIGNED NOT NULL,<br>
files_out_used INT UNSIGNED NOT NULL,<br>
files_xfer_used INT UNSIGNED NOT NULL<br>
);<br>
<br>
以上quotalimits表是FTP用户的磁盘限额配置信息,quotatallies表存放的是用户磁盘限额变动的信息。<br>
quotatallies表不需要作修改,由程序自动记录<br>
下面是quotalimits 表中各字段的含意:<br>
quota_type 磁盘限额的鉴别<br>
bytes_in_avail 上传最大字节数,就是FTP用户空间容量<br>
bytes_out_avail 下载最大字节数<br>
bytes_xfer_avail 总共可传输的文件的最大字节数(上传和下载流量)<br>
files_in_avail 总共能上传文件的数目<br>
files_out_avail 能从服务器上下载文件的总数目<br>
files_xfer_avail 总共可传输文件的数目(上传和下载)<br>
5 数据表数据初始化<br>
表全部建完后,就可以创建FTP用户了,在ftpUser表中插入一条记录如下:<br>
INSERT INTO ftpUser (userid, passwd, uid, gid, homedir, shell) values ('shine', password(‘yourpassword’), '2003', '2003', '/home/shine', '' );<br>
以上建立了一个新的FTP用户,用户名为shine,密码为yourpassword,可以看到密码用mysql的系统函数password进行了加密,用户id和组id均为2003,这里随便填,我填了和系统用户ftpUser和系统组ftpGroup相同的id,不知道会不会有问题。/home/shine为用户主目录,用户shell为空。<br>
如果要想应用到更多的功能,且建立了组的数据表,你也要为此添加记录,不过一定要注意在members的字段多个成员一定要用逗号隔开。<br>
INSERT INTO ftpGroup VALUES ('ftpGroup', 2003, 'ftpUser');<br>
下面再来建立初始的用户磁盘限额信息:<br>
将已经建立的shine帐号赋予50M空间,最多能上传500个文件,文件传输流量为512k,总共只能传输2000个文件,插入记录如下:<br>
INSERT INTO quotalimits (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)VALUES (‘shine’, ‘user’, ‘true’, ‘soft’, ‘51200000’, ‘0’,’512000’,‘500’,’0’,’2000’);<br>
6 运行proftpd<br>
执行以下命令启动proftpd服务:<br>
/usr/local/proftpd/sbin/proftpd<br>
开一个控制台输入:<br>
ftp ftpHostName<br>
输入用户名:shine<br>
输入用户密码:yourpassword<br>
成功登录后执行:<br>
quote site quota<br>
可以看到此用户的磁盘使用情况。<br>
7 配置proftpd执行脚本<br>
cd /usr/local/proftpd/bin<br>
vi proftpd<br>
输入以下内容:<br>
#!/bin/sh<br>
<br>
# ProFTPD files<br>
FTPD_BIN=/usr/local/proftpd/sbin/proftpd<br>
FTPD_CONF=/usr/local/proftpd/etc/proftpd.conf<br>
PIDFILE=/usr/local/proftpd/var/proftpd.pid<br>
# If PIDFILE exists, does it point to a proftpd process?<br>
if [ -f $PIDFILE ]; then<br>
pid=`cat $PIDFILE`<br>
fi<br>
if [ ! -x $FTPD_BIN ]; then<br>
echo "$0: $FTPD_BIN: cannot execute"<br>
exit 1<br>
fi<br>
case $1 in<br>
start)<br>
if [ -n "$pid" ]; then<br>
echo "$0: proftpd [PID $pid] already running"<br>
exit<br>
fi<br>
if [ -r $FTPD_CONF ]; then<br>
echo "Starting proftpd..."<br>
$FTPD_BIN -c $FTPD_CONF<br>
else<br>
echo "$0: cannot start proftpd -- $FTPD_CONF missing"<br>
fi<br>
;;<br>
stop)<br>
if [ -n "$pid" ]; then<br>
echo "Stopping proftpd..."<br>
kill -TERM $pid<br>
else<br>
echo "$0: proftpd not running"<br>
exit 1<br>
fi<br>
;;<br>
restart)<br>
if [ -n "$pid" ]; then<br>
echo "Rehashing proftpd configuration"<br>
kill -HUP $pid<br>
else<br>
echo "$0: proftpd not running"<br>
exit 1<br>
fi<br>
;;<br>
*)<br>
echo "usage: $0 {start|stop|restart}"<br>
exit 1<br>
;;<br>
esac<br>
exit 0<br>
存盘退出。<br>
chmod +x proftpd<br>
修改此脚本为可执行。<br>
ln –s ./proftpd /etc/rc.d/init.d/proftpd<br>
在/etc/rc.d/init.d/目录中做一个软链接指向proftpd脚本文件。<br>
<br>
cd /etc/rc.d/rc0.d<br>
ln –s ../init.d/proftpd ./K15proftpd<br>
cd ../rc1.d<br>
ln –s ./init.d/proftpd /K15proftpd<br>
cd ../rc2.d<br>
ln –s ./init.d/proftpd /K15proftpd<br>
cd ../rc3.d<br>
ln –s ./init.d/proftpd /S91proftpd #注意S后面的数字,如果在此目录中存在mysql相关的链接文件,请保证这个数字比那个文件中S后面的数字大!这样proftpd将在mysql数据库服务启动以后再启动,这是个良好的启动顺序,当然不用管它也没什么问题。<br>
cd ../rc4.d<br>
ln –s ./init.d/proftpd /S91proftpd<br>
cd ../rc5.d<br>
ln –s ./init.d/proftpd /S91proftpd<br>
cd ../rc6.d<br>
ln –s ./init.d/proftpd /K15proftpd<br>
<br>
经过以上设置,每次系统开机时proftpd服务将会自动启动,关机时则会自动停止。<br>
当然,也不必在每个rc目录中都加上链接,实际上只需要在执行启动任务的rc目录中加上就行了,比如rc3.d,rc4.d,rc5.d,其中rc4.d也不是必需的,而rc3.d是在系统进入运行级三时自动运行的,无论如何这里要有proftpd的链接,运行级三是系统正常启动的级别,而运行级四则是预留的用户自定义的运行级,所以可不管它,运行级5是启动X-Window的,但一般情况下是先进入运行级三,然后才是运行级五,所以也不用在rc5.d目录中建立proftpd的链接,而运行级六是系统重启,就不用说了。<br>
一句题外话:<br>
想切换系统运行级可执行:init number,number是代表运行级的数字,举个例子:<br>
init 5等同于startx<br>
init 6等同于reboot<br>
其它运行级就不在这里一一介绍了,有兴趣的朋友可自行查阅相关资料。<br>
注意这里的端口号是5801,相应的要连接第二个VNC服务则改为5802,以此类推。<br>
8 FAQ<br>
大家如果有什么问题我会在这里予以解答。<br>
9 其它问题<br>
暂无。<br>
<br>
如有任何疑问请mailto:shinesoft@21cn.com<br>
<br>
<br>
written by Shine<br>
湖北华大网络教育有限责任公司<br>
武汉市武昌区中北路<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -