转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> MySql >> 正文
Proftpd1.2.8+mysql3.23.56用户认证+quota磁盘限额v1.0         ★★★★

Proftpd1.2.8+mysql3.23.56用户认证+quota磁盘限额v1.0

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1926 更新时间:2009/4/22 20:56:57
摘要
本文介绍一个非常好的ftp服务安装,实现了数据库管理和磁盘限额。只要稍微修改一下,就可以作为个人主业页服务器的服务平台!(文章参考了一些网上的文档,因为写的时间久了,记不起,希望不要见怪!)(2003-08-15 10:39:43)

By 光辉

Proftpd1.2.8+mysql3.23.56用户认证+quota磁盘限额

安装环境:redhat8,安装选择的是自定义,没选数据库和ftp部分(因为我们要自己编译,如果安装了也没问题,你可以rpm -qa|grep mysql ,然后rpm -e mysql*.rpm卸载掉
网上关于proftpd的安装文章实在是不少,我只是稍微整理了一下,并且使用了新的 quota磁盘限额模块,mysql选择3.23.56版。
首先下载源码
proftpd1.2.8:
ftp://ftp.proftpd.org/上下载吧
ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.8.tar.gz

mod_quotatab-1.2.7
http://www.castaglia.org/proftpd/modules/proftpd-mod-quotatab-1.2.7.tar.gz(对应proftpd1.2.8版本的)
mysql3.23.56:
http://www.mysql.com/downloads/mysql-3.23.html#Source
注意是下载源代码包(我一般喜欢自己编译)
全部下载到/root目录。

1,安装mysql3.23.56
#groupadd mysql
#useradd -g mysql mysql
#cd /root
#tar -zxvf mysql-3.23.56.tar.gz
#cd mysql-3.23.56
#./configure --prefix=/usr/local/mysql
#make
#make install
#scripts/mysql_install_db
#chown -R root /usr/local/mysql
#chown -R mysql /usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql
#cp support-files/my-medium.cnf /etc/my.cnf
#/usr/local/mysql/bin/safe_mysqld --user=mysql &

2,安装proftpd
将proftpd的源码包解压缩到某临时目录下:
localhost# tar -zxvf proftpd-1.2.8.tar.gz
解压缩 mod_quotatab-1.2.7
localhost# tar -zxvf proftpd-mod-quotatab-1.2.7.tar.gz
进入 mod_quotatab 目录
localhost proftpd# cd mod_quotatab
把mod_quotatab中的文件拷贝到 proftpd 中的modules 目录中
localhost mod_quotatab# cp * ../proftpd-1.2.8/modules
在开始运行configure之前,我们要先改动一个文件
进入 proftpd-1.2.8/contrib 目录
localhost mod_quotatab # cd ../proftpd-1.2.8/contrib
修改 mod_sql_mysql.c
localhost contrib# vi mod_sql_mysql.c
找到#include 把他该为你实际路径
如果你的mysql 安装在/usr/local/mysql 下,就像我前面一样,就把它修改为#include
然后
localhost contrib# cd ..
localhostproftpd-1.2.7#./configure --prefix=DIR --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=DIR --with-libraries=DIR
需要修改的三个地方
--prefix=DIR 你要安装到哪里
--with-includes=DIR mysql 的includes 目录
--with-libraries=DIR mysql 的lib 目录
然后
make
make install 完成安装

3.配置proftpd.conf
接下来,进入你安装好的proftpd目录 ,修改etc/proftpd.conf 文件开始配置
基本配置讲解:
示例:proftpd.conf
ServerName "HRBEU''''s ftp server" #服务名
ServerType standalone #f服务器启动方式
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
#limit the user in his owner directory
DefaultRoot ~ #限制用户只能在自己的目录里,不能上去进入其他目录
#put the proftpd log files in /var/log/ftp.syslog
SystemLog /data/logs/ftp.syslog #proftpd的系统日志存放地
#TransferLog log files
TransferLog /data/logs/ftp.transferlog #传输日志存放地
#set The maxtimes user Attempts times
MaxLoginAttempts 30 #当登陆失败后,可以尝试登陆的次数
#setup the Restart
AllowRetrieveRestart on
#setup the download and upload speed
#TransferRate [kilobytes-per-sec[:100]] #1.2.8版本的速率限制
#setup the disk quota
QuotaDirectoryTally on
#quota b"|"Kb"|"Mb"|"Gb"
#setup the disk quota
#QuotaDirectoryTally on
#quota b"|"Kb"|"Mb"|"Gb"
QuotaDisplayUnits Kb
QuotaEngine on
QuotaLog /data/logs/Quota.log
QuotaShowQuotas on
# We put our mod_sql directives in a block so they''''ll be
# inherited by the block below, and any other
# blocks we may want to add. For a simple server these don''''t need to
# be in a block but it won''''t hurt anything.

# Specify our connection information. Both mod_sql_mysql and
# mod_sql_postgres use the same format, other backends may specify a
# different format for the first argument to SQLConnectInfo. By not
# specifying a fourth argument, we''''re defaulting to ''''PERSESSION''''
# connections -- a connection is made to the database at the start of
# the session and closed at the end. This should be fine for most
# situations.
# SQLConnectInfo dbname@host:port username password
SQLConnectInfo ftp@localhost:3306 wgh 58648217
# Specify our authentication schemes. Assuming we''''re using
# mod_sql_mysql, here we''''re saying ''''first try to authenticate using
# mysql''''s password scheme, then try to authenticate the user''''s
# password as plaintext''''. Note that ''''Plaintext'''' isn''''t a smart way to
# store passwords unless you''''ve got your database well secured.
SQLAuthTypes Backend Plaintext
# Specify the table and fields for user information. If you''''ve
# created the database as it specifies in ''''README.mod_sql'''', you don''''t
# need to have this directive at all UNLESS you''''ve elected not to
# create some fields. In this case we''''re telling mod_sql to look in
# table ''''users'''' for the fields ''''username'''',''''password'''',''''uid'''', and
# ''''gid''''. The ''''homedir'''' and ''''shell'''' fields are specified as ''''NULL'''' --
# this will be explained below.
# SQLUserInfo users username password uid gid NULL NULL
SQLUserInfo FTPUSERS userid passwd uid gid home shell
SQLGroupInfo FTPGRPS groupname gid members
# Here we tell mod_sql that every user it authenticates should have
# the same home directory. A much more common option would be to
# specify a homedir in the database and leave this directive out. Note
# that this directive is necessary in this case because we specified
# the homedir field as ''''NULL'''', above. mod_sql needs to get homedir
# information from *somewhere*, otherwise it will not allow access.
# SQLDefaultHomedir "/tmp"
# This is not a mod_sql specific directive, but it''''s here because of
# the way we specified ''''SQLUserInfo'''', above. By setting this to
# ''''off'''', we''''re telling ProFTPD to allow users to connect even if we
# have no (or bad) shell information for them. Since we specified the
# shell field as ''''NULL'''', above, we need to tell ProFTPD to allow the
# users in even though their shell doesn''''t exist.
RequireValidShell off
# Here we tell mod_sql how to get out group information. By leaving
# this commented out, we''''re telling mod_sql to go ahead and use the
# defaults for the tablename and all the field names.
# SQLGroupInfo groups groupname gid members
# For small sites, the following directive will speed up queries at
# the cost of some memory. Larger sites should read the complete
# description of the ''''SQLAuthenticate'''' directive; there are options
# here that control the use of potentially expensive database
# queries. NOTE: these arguments to ''''SQLAuthoritative'''' limit the way
# you can structure your group table. Check the README for more
# information.
SQLAuthenticate users
# Finally, some example logging directives. If you have an integer
# field named ''''count'''' in your users table, these directives will
# automatically update the field each time a user logs in and display
# their current login count to them.
# SQLNamedQuery getcount SELECT "count, userid from users where userid=''''%u''''"
# SQLNamedQuery updatecount UPDATE "count=count+1 WHERE userid=''''%u''''" users
# SQLShowInfo PASS "230" "You''''ve logged on %{getcount} times, %u"
# SQLLog PASS updatecount
SQLHomedirOnDemand on
#...SQL...............
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 quotalimits 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 quotatallies 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}''''" quotatallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies

QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
# close our block.

#全局设置完成
# 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 normal user and group permissions for the server.
User FTPUSR
Group FTPGRP
# Normally, we want files to be overwriteable.

AllowOverwrite on

# A basic anonymous configuration, no upload directories. If you
# don''''t want to support anonymous access, simply remove this
# ... block.

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 100
# 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

DenyAll


4,mysql 用户认证部分

在proftpd.conf中加

[1] [2]  下一页


[MySql]PHP存取 Mysql 数据乱码终极解决方案  [MySql]解决Table xxx is marked as crashed and should …
[MySql][MySQL]快速解决"is marked as crashed and shoul…  [MySql]MySQL DELETE语法用法详解
[MySql]mysql中时间日期格式化  [MySql]修改mysql导入文件大小限制
[其他]MySql常用命令大全  [Web开发]把ACCESS的数据导入到Mysql中的方法详解
[MySql]解决mysql 1040错误Too many connections的方法  [系统软件]利用crontab系统每天定时备份MySQL数据库
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台