当前位置:操作系统 > Unix/Linux >>

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

摘要

  本文介绍一个非常好的ftp服务安装,实现了数据库管理和吃盘限额。只要稍微修改一下,就可以作为个人主业页服务器的服务平台!(文章参考了一些网上的文档,因为写的时间久了,记不起,希望不要见怪!)(2003-08-15 10:39:43)

  安装环境: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 易做图 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 t
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,