⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1471.html

📁 著名的linux英雄站点的文档打包
💻 HTML
📖 第 1 页 / 共 3 页
字号:
#数据库的鉴别<br>
SQLAuthenticate users groups usersetfast groupsetfast<br>
#如果home目录不存在,则系统会为根据它的home项新建一个目录:<br>
SQLHomedirOnDemand on<br>
然后在这个数据库中建立一个用户表FTPUSERS,这个表是必须的:<br>
use ftp;<br>
create table FTPUSERS (<br>
userid TEXT NOT NULL,<br>
passwd TEXT NOT NULL,<br>
uid INT NOT NULL,<br>
gid INT NOT NULL,<br>
home TEXT,<br>
shell TEXT<br>
);<br>
此表格是为了用户认证所需要的,其中userid、passwd是必不可少的,userid是用做FTP服务的用户名;passwd是指此用户的密码; uid是系统用户的ID,也就是所映射的系统用户;gid是所属系统组的ID;home是该用户所在的HOME目录;shell可以为该用户指定相应的 shell。当然你可以建立更多的字段,例如:用来记录用户登录次数的count,或者是日期的date,如果你对配置熟悉了之后,你可以根据自己的喜欢添加更多的功能。在此就不多讲。<br>
3、如果你想需要所有的功能,你还可以添加另外一个需要的表:FTPGRPS,也就是确定组的表格,当然也可以不用,这里讲一个它的格式:<br>
create table FTPGRPS (<br>
grpname TEXT NOT NULL,<br>
gid SMALLINT NOT NULL,<br>
members TEXT NOT NULL,<br>
);<br>
其中grpname是组的名称,gid是系统组的ID,members是组的成员。注意:多成员,他们之间要用逗号隔开,不能使用空格。<br>
4、为空表格插入记录:<br>
INSERT INTO FTPUSERS (userid, passwd, uid, gid, home, shell)<br>
valueS ('user1', '999999', '1000', '1000', '/home/FTP/user1', '' );<br>
按此格式你可以插入这每一个用户添加一个记录。<br>
如果你要想应用到更多的功能,且建立了组的表格,你也要为此添加记录,不过一定要注意在members的字段多个成员一定要用逗号隔开。<br>
INSERT INTO FTPGRPS VALUES ('FTPGRPS', 1000, 'FTPUSR');<br>
四、为FTP用户建立相应的系统用户。<br>
在本例中,只整个FTP服务只提供一个有效的系统用户FTPUSR和组FTPGRP,当然你也可以设置多个系统用户。但出于安全的考虑,我只设一个,用他来启动FTP daemon,并把所有的FTP用户映射过这个用户。<br>
先建立FTPGRP组:<br>
groupadd -g 1000 -r FTPGRP<br>
建立FTPUSR用户:<br>
adduser -u 1000 -g 1000 -d /home/FTP -s /bin/bash -r FTPUSR<br>
为FTPUSR建立HOME,把所有的FTP user 活动空间全放在此目录下:<br>
mkdir /home/FTP<br>
chown FTPUSR /home/FTP<br>
chgrp FTPGRP /home/FTP<br>
到这里MYSQL认证部分就算基本配置好了,接下来是磁盘限额部分<br>
首先,还是编辑proftpd文件<br>
#磁盘限额部分<br>
QuotaDirectoryTally on<br>
#磁盘限额单位 b"|"Kb"|"Mb"|"Gb"<br>
QuotaDisplayUnits "Kb"<br>
QuotaEngine on<br>
#磁盘限额日志记录<br>
QuotaLog "你的LOG路径"<br>
# 打开磁盘限额信息,当登陆FTP帐户后,使用命令 "quote SITE QUOTA" 后可显示当前用户的磁盘限额<br>
QuotaShowQuotas on<br>
#以下是SQL调用语句,不用修改直接拷贝过去<br>
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, <br>
bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM quotalimits <br>
WHERE name = '%{0}' AND quota_type = '%{1}'"<br>
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, <br>
bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM quotatallies <br>
WHERE name = '%{0}' AND quota_type = '%{1}'"<br>
<br>
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, <br>
bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, <br>
files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, <br>
files_xfer_used = files_xfer_used + %{5} <br>
WHERE name = '%{6}' AND quota_type = '%{7}'" quotatallies<br>
<br>
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies<br>
<br>
QuotaLimitTable sql:/get-quota-limit<br>
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally<br>
<br>
然后建立mysql 数据表<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>
<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>
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>
<br>
开始使用磁盘限额,我们要将上面建立的user1帐号给予10M空间,最多能上传500个文件到服务器上,文件传输流量为20M,只能传输10个文件。只要在MYSQL中插入<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` )<br>
VALUES ('user1', 'user', 'false', 'soft', '10240000', '0', '2048000', '500', '0', '10');<br>
就可以了,不需要设置的部分用0代替就可以了<br>
现在运行proftpd,登陆到user1 ,使用quote SITE QUOTA 就会显示user1用户的磁盘使用情况<br>
ftp&gt; quote SITE QUOTA<br>
200-The current quota for this session are [current/limit]:<br>
Name: user1<br>
Quota Type: User<br>
Per Session: False<br>
Limit Type: Soft<br>
Uploaded Kb: 0.00/10000.00<br>
Downloaded Kb: unlimited<br>
Transferred Kb: 0.00/2000.00<br>
Uploaded files: 0/500<br>
Downloaded files: unlimited<br>
Transferred files: 0/10<br>
200 Please contact root@localhost if these entries are inaccurate<br>
OK,安装完毕<br>
<br>
附件:启动和关闭proftpd<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>
至于你现在想写什么样的php程序来控制数据库,然后让一切web化,就不在本文讨论范围了。其实大家只要稍微修改一下,就可以作为虚拟主机提供给大家。因为你可以修改数据表!<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>版权所有 &copy; 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 + -