分享
 
 
 

我的proftpd+mysql+quota@debian安装流水笔记

王朝mysql·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

一。准备工做

1。你的机器上已调试好了apache+php+mysql环境

2。下载PROFTPD

wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.10rc3.tar.bz2

因为发现1.2.10直接支持sql和quota

二。安装

tar -jxvf proftpd-1.2.10rc3.tar.bz2

cd proftpd*

引用:

./configure --prefix=/usr/local/proftpd \\ --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \\ --with-includes=/usr/local/mysql/include/mysql \\ --with-libraries=/usr/local/mysql/lib/mysql

make&&make install

修改proftpd配置

vim /usr/local/proftpd/etc/proftpd.conf

内容改为:

ServerName "mail2004.3322.org"

ServerType standalone

DefaultServer on

# 用户登陆时不显示ftp服务器版本信息

ServerIdent off

# 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

MaxLoginAttempts 3

TimeoutLogin 120

TimeoutIdle 600

TimeoutNoTransfer 900

TimeoutStalled 3600

MaxClients 100

# 设置每台主机最多并发连接数

MaxClientsPerHost 3

AllowOverwrite no

AllowStoreRestart on

UseReverseDNS off

# 设置如果shell为空时允许用户登录

RequireValidShell off

# 将用户限制在自己的主目录下

DefaultRoot ~

# 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 user and group under which the server will run.

User nobody

Group nobody

# Normally, we want files to be overwriteable.

<Directory />

AllowOverwrite on

</Directory>

# A basic anonymous configuration, no upload directories.

# 匿名登录设置。匿名用户目录为/ftp

<Anonymous /ftp>

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 10

# 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

#<Limit WRITE>

# DenyAll

#</Limit>

</Anonymous>

以上是PROFTPD.conf

下面加入sql和quota

# 数据库联接的信息,proftpdb是数据库名,localhost是主机名,proftpd是连接数据库的用户名,

#proftpdb是密码

#(如果没有密码留空)

SQLConnectInfo proftpdb@localhost proftp proftpdb

# 数据库认证的类型

SQLAuthTypes Backend Plaintext

# 数据库的鉴别

SQLAuthenticate users* groups*

# 指定用来做用户认证的表的有关信息。

SQLUserInfo ftpuser userid passwd uid gid homedir shell

SQLGroupInfo ftpgroup groupname gid members

# 如果home目录不存在,则系统会根据它的home项新建一个目录

SQLHomedirOnDemand on

这是目录所有者,我觉得这个很重要。所以我用nobody来做,在此我的nobody为99.

SQLDefaultGID 99

SQLDefaultUID 99

SQLLog PASS updatecount

SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser

# Update modified everytime user uploads or deletes a file

SQLLog STOR,DELE modified

SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

# 启用磁盘限额

QuotaDirectoryTally on

# 磁盘限额单位 b"|"Kb"|"Mb"|"Gb"

QuotaDisplayUnits "Kb"

QuotaEngine on

# 磁盘限额日志记录

QuotaLog "/var/log/quota.log"

# 打开磁盘限额信息,当登陆FTP帐户后,使用命令 "quote SITE QUOTA" 后可显示当前用#户的磁盘限额

QuotaShowQuotas on

以下为sql语句:

SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail,bytes_out_ava

il, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits 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 ftpquotatallies 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}'" ftpquotatallies

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

QuotaLimitTable sql:/get-quota-limit

QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

下面可以用phpmyadmin在mysql里加入,我的sql为以下

CREATE TABLE `ftpgroup` (

`groupname` varchar(16) NOT NULL default '',

`gid` smallint(6) NOT NULL default '99',

`members` varchar(16) NOT NULL default '',

KEY `groupname` (`groupname`)

) TYPE=MyISAM COMMENT='ProFTP group table';

INSERT INTO `ftpgroup` VALUES ('nobody', 99, 'nobody');

CREATE TABLE `ftpquotalimits` (

`name` varchar(30) default NULL,

`quota_type` enum('user','group','class','all') NOT NULL default 'user',

`per_session` enum('false','true') NOT NULL default 'false',

`limit_type` enum('soft','hard') NOT NULL default 'soft',

`bytes_in_avail` float NOT NULL default '0',

`bytes_out_avail` float NOT NULL default '0',

`bytes_xfer_avail` float NOT NULL default '0',

`files_in_avail` int(10) unsigned NOT NULL default '0',

`files_out_avail` int(10) unsigned NOT NULL default '0',

`files_xfer_avail` int(10) unsigned NOT NULL default '0'

) TYPE=MyISAM;

CREATE TABLE `ftpquotatallies` (

`name` varchar(30) NOT NULL default '',

`quota_type` enum('user','group','class','all') NOT NULL default 'user',

`bytes_in_used` float NOT NULL default '0',

`bytes_out_used` float NOT NULL default '0',

`bytes_xfer_used` float NOT NULL default '0',

`files_in_used` int(10) unsigned NOT NULL default '0',

`files_out_used` int(10) unsigned NOT NULL default '0',

`files_xfer_used` int(10) unsigned NOT NULL default '0'

) TYPE=MyISAM;

CREATE TABLE `ftpuser` (

`id` int(10) unsigned NOT NULL auto_increment,

`userid` varchar(32) NOT NULL default '',

`passwd` varchar(32) NOT NULL default '',

`uid` smallint(6) NOT NULL default '99',

`gid` smallint(6) NOT NULL default '99',

`homedir` varchar(255) NOT NULL default '',

`shell` varchar(16) NOT NULL default '/sbin/nologin',

`count` int(11) NOT NULL default '0',

`accessed` datetime NOT NULL default '0000-00-00 00:00:00',

`modified` datetime NOT NULL default '0000-00-00 00:00:00',

PRIMARY KEY (`id`)

) TYPE=MyISAM COMMENT='ProFTP user table' ;

启动proftpd

/usr/local/proftpd/sbin/proftpd start

在数据数中的ftpuser中加入用户,密码他路径就可以了。

以上只是一个流水笔记

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有