工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.51099.com 注册 | 登陆
浏览模式: 标准 | 列表分类:ftp

pure-ftpd.conf

ChrootEveryone              yes     # 启用chroot
BrokenClientsCompatibility  yes     # 兼容不同客户端
Daemonize                   yes     # 后台运行
MaxClientsPerIP             20      # 每个ip最大连接数
VerboseLog                  yes     # 记录日志
DisplayDotFiles             no      # 显示隐藏文件
AnonymousOnly               yes     # 只允许匿名用户访问
NoAnonymous                 no      # 运行匿名用户连接
SyslogFacility              none        # 不将日志在syslog日志中显示
DontResolve                 yes     # 不进行客户端DNS解析
MaxIdleTime                 15      # 最大空闲时间
LimitRecursion              2000 8      # 浏览限制,文件2000,目录8层
AnonymousCanCreateDirs      yes     # 匿名用户可以创建目录
MaxLoad                     4           # 超出负载后禁止下载
PassivePortRange            45000 50000 # 被动模式端口范围
AnonymousRatio              1 10        # 匿名用户上传/下载比率
AntiWarez                   yes     # 禁止下载匿名用户上传但未经验证的文件
AnonymousBandwidth          200     # 匿名用户带宽限制(KB)
Umask                       133:022     # 创建文件/目录默认掩码
MinUID                      100     # 最大UID限制
AllowUserFXP                no      # 仅运行用户进行FXP传输
AllowAnonymousFXP           no      # 对匿名用户和非匿名用户允许进行匿名 FXP 传输
ProhibitDotFilesWrite       no      # 不能删除/写入隐藏文件
ProhibitDotFilesRead        no      # 禁止读取隐藏文件
AutoRename                  yes     # 有同名文件时自动重新命名
AnonymousCantUpload         no      # 不允许匿名用户上传文件
AltLog                      clf:/var/log/pureftpd.log   # clf格式日志文件位置
MaxDiskUsage                99      # 当磁盘使用量打到99%时禁止上传
CustomerProof               yes     # 防止命令误操作



重置用户属性
要禁用文件数配额,执行 pure-pw usermod -n ”
要禁用文件大小配额,执行 pure-pw usermod -N ”
要禁用上传/下载比率,执行 pure-pw usermod -q ” -Q ”
要禁用下载带宽限制,执行 pure-pw usermod -t ”
要禁止上传带宽限制,执行 pure-pw usermod -T ”
要禁止IP地址过滤,使用 pure-pw usermod <-i,-I,-r or -R> ”
要禁止登陆时间限制,执行 pure-pw usermod -z ”
要禁止最大并发数控制,执行 pure-pw usermod -y ”

vsftpd yum 安装

vsftpd yum 安装,使用系统帐号

pam_service_name=vsftpd

pure-ftpd的参数设置

-0: 当存在同名文件时,旧版本的文件不被删除或者截断,而是采用临时文件。当整个文件上传完毕之后,才指向新的文件。这个开关选项跟虚拟配额不兼容。
-1: 在系统日志的输出中,记录每个会话( Session )的 PID 。
-4: 只监听 IPv4 的连接
-6: 只监听 IPv6 的连接
-a <gid>: 只有通过认证的用户才可以直接访问它的 home 目录。该选项对没有 shell 的系统用户特别有用。注意,这里的 <gid> 是组的数组,而非字母显示。并且, root 始终对整个文件系统有完整的访问权。
-A: 除了 root 之外,都可以使用 chroot()
-b: 忽略部分 RFC 的标准,以处理完全坏掉的客户端、穿越防火墙或者 NAT 盒
-B: 以标准的方式在后台启动服务器
-c <num>: 允许同时连接的客户端数列。默认是 50
-C <num>: 同一 IP 最大连接数
-d: 在系统日志中记录各种信息,口令不会记入日志中,推荐只有需要 debug 时使用。如果两个 -d ,相应信息也一并记入日志。
-D: 即使当客户端没有使用 -a 选项时,同样列出所有以 ”.” 开头的隐藏文件。不推荐使用。
-e: 只开放匿名用户访问
-E: 只开放认证用户使用,匿名访问被禁止
-f <facility>: 使用指定程序记录系统日志,默认时 ’ftp’ 。如果使用 ’-f none’ 则不记录日志。
-F <fortune file>: 在登陆的时候显示一个 fortune 信息,而不是固定的登陆信息。其中 <fortune file> 是符合 fortune 格式的文本文件,fortune信息之间用'%'号隔开。 这是需要在编译时加入 ’—with-cookie’ 选项。如果仅仅是一个简单的文本文件,则在每次登陆是显示相同的信息。
-g <pid file>: 改变默认 pid 文件的位置。默认是位于 /var/run/pure-ftpd.pid
-G: 不允许重命名
-H: 系统默认是要对 IP 地址进行解析,才记入日志文件中。使用这个选项,则可以避免这样做。从而避免带宽的浪费。
-i: 不论目录的权限设置,匿名用户始终不能进行上传
-I <timeout>: 发呆的时间,以分钟为单位。默认是 15 分钟
-j: 如果用户的 home 目录不存在,就自动创建
-k <percentage>: 当 FTP 服务器占用空间超过规定的百分比,则不能再上传文件了。不用加 ’%
-K: 允许用户 resume 和 upload 文件,但是不可以删除和重命名这些文件。空的文件夹也可以被删除。可以通过 ’-r’ 禁止该选项。
-l <authentication> 或者 -l <authentication>:<config file>: 添加一个新的规则
-L <max files>:<max depth>: 默认的, pure-ftpd 不会显示超过 2000 个文件或者深度大于 5 的路径
-m <cpu load>: 如果 CPU 负载超过指定值,则不运行匿名用户下载。但是上传依然允许
-M: 允许匿名用户创建目录
-n <max files>:<max size>: 如果服务器被编译成支持虚拟配额,则该选项可以约束所有的用户(新任组的用户出外)。其中,最大的文件大小以 M 为单位
-N:NAT 模式,强制 Active 。当 ftp 服务器位于 NAT 、伪装网关或者路由器后面时,如果无法正常访问,可以采用此选项。
-o: 将所有上传的文件写入 ’/var/run/pure-ftpd.upload.pipe’ ,使得 ’pure-uploadscipte’ 程序可以运行。
-O <format>:<log file>: 以指定格式将文件传输记入日志文件中。目前支持的格式包括: CLF 、 Stats 、 W3C 和 xferlog
-p <first port>:<last port>: 包括被动模式在内,服务器只会选择从开始到结束的端口进行监听。
-P <ip address or host name>: 对 PASV 、 EPSV 和 SPSV 命令的相应,强制以指定的 IP 地址或 hostname 相应。
-q <upload ratio>:<download ratio>: 为匿名用户指定上传和下载 ration
-Q <upload ratio>:<download ratio>: 为除了 root 组的用户外的所有人指定上传和下载 ratio 。 root 组的用户没有 ratio 限制
-r: 永远不覆盖已经存在的文件。这是,上传一个已经存在的文件时,会自动为其重命名,入: xyz 、 xyz.1 、 xyz.2 。如果编译时使用 ” make AUTORENAME_REVERSE_ORDER=1” ,则重命名的文件是 1.xyz 、 2.xyz
-R: 即使是非匿名用户(除了 root 之外),也不允许使用 chmod 命令
-s: 不允许匿名用户下载属主是 ftp 的文件(其它匿名用户上传的文件)。这样可以保证必须经过管理员的修改,这些文件才能被匿名用户下载。
-S  绑定到指定的地址和端口。例:
/usr/local/sbin/pure-ftpd -S 21
/usr/local/sbin/pure-ftpd -S 192.168.0.1
/usr/local/sbin/pure-ftpd -S 192.168.0.1,21
/usr/local/sbin/pure-ftpd -S mci.uestc.edu.cn,21
-t <bandwidth> 和 -T <bandwidth>: 带宽限制。 <bandwidth> 是以 k/s 为单位,同时可以指定上传和下载的带宽,支持 [<upload>]:[<download>] 语法
-u <uid>: 禁止 uid 小于 <uid> 的用户登陆。 -u 1 可以禁止 root 用户登陆, -u 100 可以禁止绝大多数系统虚拟用户登陆。
-U <umask for files>:<umask for dirs>: 改变默认的掩码,默认的是 133:022 。如果希望上传的文件只能被上传该文件的用户读,使用 ’-U 177:077’ 。如果希望上传的文件可以被执行,使用 022:022 (文件可以被其它用户读,但是不能写)。 077:077 文件只能被所有者执行或者读。 Pure-ftpd 支持 SITE CHMOD ,使得用户可以被改变自己文件的属性。
-V <ip address>: 只允许在指定地址的非匿名的 FTP 访问。这时,可以将公网 IP 路由到一个指定的内网 IP 地址,或者将新任的 IP 地址路由到指定的内网 IP 地址。
-v <name>: 支持苹果的 Bonjor ,只有当 Bonjor 选择在编译的时候支持是,苹果的 MacOS X 才能有此属性。
-w: 只对认证的用户支持 FXP 协议
-W: 支持 FXP 协议
-x: 默认时,非匿名用户可以读和写以 ’.’ 开头的隐藏文件,而匿名用户则不可以。当该选项指定时,用户只能下载这些文件,但是不能覆盖和创建,即使该用户时是该文件的属主。如果希望是用户可以访问特定的以 ’.’ 开头的文件,可以通过建立该文件的链接(非 ’.’ 开头的文件名)达到目的
-X: 用户除了不能写以 ’.’ 开头的文件,如果使用了该选项,用户不能读这样的文件,也不能进入这样的目录。(当以 ’-a’ 参数启动,受信的用户可以绕开 ’-x’ 和 ’-X’ 的限制)
-y <max user logins>:<max anonymous logins>: 如果编译时加入了 --with-peruserlimits 选项,该选项限制了同一个用户可以同时拥有的 session 数目。空值 ’0’ 意味着没有限制
-z: 允许匿名用户读以 ’.’ 开头的文件和目录
-Z: 避免用户犯简单的错误。当前,该选项可以避免用户错误的使用 chmod 命令,防止他们不能访问自己的文件或者目录。该选项在将来还会有更多的功能。所以,推荐 host 服务器打开该参数

pureftpd

各参数注释
User:用户名
status:状态 1为激活状态 0为非激活状态
Password :密码
Uid:用户系统ID号
GID:用户组ID号
ULBandwidth :上传最大带宽 单位 KB/S
DLBandwidth:下载最大带宽  单位 KB/S
comment  :注释
ipaccess :允许访问IP地址
QuotaSize :磁盘配额总大小 单位MB
QuotaFiles  :允许存放的文件数目个数 0为不限制

然后用这个帐号测试,/home/askwan1自动建立
新增加帐号可以通过phpmyadmin来添加。

相关连接和参考资料文档:
   PureFTPd: http://www.pureftpd.org
    MySQL: http://www.mysql.com
    phpMyAdmin: http://www.phpmyadmin.net

pure-ftpd.conf设置

限制用户在其主目录
ChrootEveryone yes
兼容ie等比较非正规化的ftp客户端,否则用IE打开不自动弹出登陆对话框
BrokenClientsCompatibility yes
服务器总共允许同时连接的最大用户数
MaxClientsNumber 500
同一IP允许同时连接的用户数
MaxClientsPerIP 500
不允许匿名连接,仅允许认证用户使用,否则不自动打开登陆对话框
NoAnonymous yes
MySQL 配置文件 (参考 README.MySQL)
MySQLConfigFile /etc/pureftpd-mysql.conf
启用简单的 Unix系统 认证方式(/etc/passwd), 使linux用户可登陆
UnixAuthentication yes
认证用户允许登陆的最小组ID(UID),设为0使root可登陆
MinUID 0
用户主目录不存在的话,自动创建
CreateHomeDir yes
# 被动连接响应的端口范围。- for firewalling.
PassivePortRange          30000 50000
要启用被动模式,需在防火墙开放30000:50000端口
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 30000:50000 -j ACCEPT






pure-ftpd.conf 中文说明




# 如果你想要使用配置文件代替命令行选项来运行 Pure-FTPd ,请运行下面的命令:
#
# RPM 缺省使用另外一个配置文件:
# /etc/sysconfig/pure-ftpd
#
# 请不要忘了浏览一下 http://www.pureftpd.org/documentation.html
# 文档,查看全部的选项列表。
# 限制所有用户在其主目录中
  ChrootEveryone              yes
# 如果前一个指令被设置为了 "no",下面组的成员(GID)就不受主目录的限制了。而其他的用户还是
# 会被限制在自己的主目录里。如果你不想把任何用户限制在自己的主目录里,只要注释掉 ChrootEveryone
# 和 TrustedGID 就可以了。
# TrustedGID                    100
# 兼容ie等比较非正规化的ftp客户端
  BrokenClientsCompatibility  no
# 服务器总共允许同时连接的最大用户数
  MaxClientsNumber            50
# 做为守护(doemon)进程运行(Fork in background)
  Daemonize                  yes
# 同一IP允许同时连接的用户数(Maximum number of sim clients with the same IP address)
  MaxClientsPerIP            8
# 如果你要记录所有的客户命令,设置这个指令为 "yes"。
# This directive can be duplicated to also log server responses.
  VerboseLog                  no
# 即使客户端没有发送 '-a' 选项也列出隐藏文件( dot-files 。
  DisplayDotFiles            yes
# 不允许认证用户 - 仅作为一个公共的匿名FTP。
  AnonymousOnly              no
# 不允许匿名连接,仅允许认证用户使用。
  NoAnonymous                no
# Syslog facility (auth, authpriv, daemon, ftp, security, user, local*)
# 缺省的功能( facility 是 "ftp"。 "none" 将禁止日志。
  SyslogFacility              ftp
# 定制用户登陆后的显示信息(Display fortune cookies)
# FortunesFile              /usr/share/fortune/zippy
# 在日志文件中不解析主机名。日志没那么详细的话,就使用更少的带宽。在一个访问量很大 
# 的站点中,设置这个指令为 "yes" ,如果你没有一个能工作的DNS的话。
  DontResolve                yes
# 客户端允许的最大的空闲时间(分钟,缺省15分钟)
  MaxIdleTime                15
# LDAP 配置文件 (参考 README.LDAP)
# LDAPConfigFile                /etc/pureftpd-ldap.conf
# MySQL 配置文件 (参考 README.MySQL)
# MySQLConfigFile              /etc/pureftpd-mysql.conf
# Postgres 配置文件 (参考 README.PGSQL)
# PGSQLConfigFile              /etc/pureftpd-pgsql.conf
# PureDB 用户数据库 (参考 README.Virtual-Users)
# PureDB                        /etc/pureftpd.pdb
# pure-authd 的socket 路径(参考 README.Authentication-Modules)
# ExtAuth                      /var/run/ftpd.sock
# 如果你要启用 PAM 认证方式, 去掉下面行的注释。
# PAMAuthentication            yes
# 如果你要启用 简单的 Unix系统 认证方式(/etc/passwd), 去掉下面行的注释。
# UnixAuthentication            yes
# 请注意,LDAPConfigFile, MySQLConfigFile, PAMAuthentication 和
# UnixAuthentication 这些指令只能被使用一次,不过,他们能被混合在一起用。例如:如果你使用了
# MySQLConfigFile 和 UnixAuthentication,那么 SQL 服务器将被访问。如果因为用户名未找
# 到而使 SQL 认证失败的话,就会在/etc/passwd 和 /etc/shadow 中尝试另外一种认证,如果因
# 为密码错误而使 SQL 认证失败的话,认证就会在此结束了。认证方式由它们被给出来的顺序而被链
# 接了起来。
# 'ls' 命令的递归限制。第一个参数给出文件显示的最大数目。第二个参数给出最大的子目录深度。
  LimitRecursion              2000 8
# 允许匿名用户创建新目录?
  AnonymousCanCreateDirs      no
# 如果系统被 loaded 超过下面的值,匿名用户会被禁止下载。
  MaxLoad                    4
# 被动连接响应的端口范围。- for firewalling.
# PassivePortRange          30000 50000
# 强制一个IP地址使用被动响应( PASV/EPSV/SPSV replies)。 - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
# addresses.
# ForcePassiveIP                192.168.0.1
# 匿名用户的上传/下载的比率。
# AnonymousRatio                1 10
# 所有用户的上传/下载的比率。
# This directive superscedes the previous one.
# UserRatio                1 10
# 不接受所有者为 "ftp" 的文件的下载。例如:那些匿名用户上传后未被本地管理员验证的文件。
  AntiWarez                  yes
# 服务监听的IP 地址和端口。(缺省是所有IP地址和21端口)
# Bind                      127.0.0.1,21
# 匿名用户的最大带宽(KB/s)。
# AnonymousBandwidth            8
# 所有用户的最大带宽(KB/s),包括匿名用户。
# Use AnonymousBandwidth *or* UserBandwidth, both makes no sense.
# UserBandwidth            8
# 新建目录及文件的属性掩码值。<文件掩码>:<目录掩码> .
# 177:077 if you feel paranoid.
  Umask                      133:022
# 认证用户允许登陆的最小组ID(UID) 。
  MinUID                      100
# 仅允许认证用户进行 FXP 传输。
  AllowUserFXP                yes
# 对匿名用户和非匿名用户允许进行匿名 FXP 传输。
  AllowAnonymousFXP          no
# 用户不能删除和写点文件(文件名以 '.' 开头的文件),即使用户是文件的所有者也不行。
# 如果 TrustedGID 指令是 enabled ,文件所属组用户能够访问点文件(dot-files)。
  ProhibitDotFilesWrite      no
# 禁止读点文件(文件名以 '.' 开头的文件) (.history, .ssh...)
  ProhibitDotFilesRead        no
# 永不覆盖文件。当上传的文件,其文件名已经存在时,自动重命名,如: file.1, file.2, file.3, ...
  AutoRename                  no
# 不接受匿名用户上传新文件( no = 允许上传)
  AnonymousCantUpload        no
# 仅允许来自以下IP地址的非匿名用户连接。你可以使用这个指令来打开几个公网IP来提供匿名FTP,
# 而保留一个私有的防火墙保护的IP来进行远程管理。你还可以只允许一内网地址进行认证,而在另外
# 一个IP上提供纯匿名的FTP服务。
#TrustedIP                  10.1.1.1
# 如果你要为日志每一行添加 PID  去掉下面行的注释。
# LogPID                    yes
# 使用类似于Apache的格式创建一个额外的日志文件,如:
# fw.c9x.org - jedi [13/Dec/1975:19:36:39] "GET /ftp/linux.tar.bz2" 200 21809338
# 这个日志文件能被 www 流量分析器处理。
# AltLog                    clf:/var/log/pureftpd.log
# 使用优化过的格式为统计报告创建一个额外的日志文件。
# AltLog                    stats:/var/log/pureftpd.log
# 使用标准的W3C格式创建一个额外的日志文件。(与大部分的商业日志分析器兼容)
# AltLog                    w3c:/var/log/pureftpd.log
# 不接受 CHMOD 命令。用户不能更改他们文件的属性。
# NoChmod                    yes
# 允许用户恢复和上传文件,却不允许删除他们。
# KeepAllFiles                yes
# 用户主目录不存在的话,自动创建。
# CreateHomeDir              yes
# 启用虚拟的磁盘限额。第一个数字是最大的文件数。
# 第二个数字是最大的总的文件大小(单位:Mb)。
# 所以,1000:10 就限制每一个用户只能使用 1000 个文件,共10Mb。
# Quota                      1000:10
# 如果你的 pure-ftpd 编译时加入了独立服务器( standalone 支持,你能够改变 pid 文件
# 的位置。缺省位置是 /var/run/pure-ftpd.pid 。
# PIDFile                    /var/run/pure-ftpd.pid
# 如果你的 pure-ftpd 编译时加入了 pure-uploadscrīpt 支持,这个指令将会使 pure-ftpd
# 发送关于新上传的情况信息到 /var/run/pure-ftpd.upload.pipe,这样 pure-uploadscrīpt
# 就能读然后调用一个脚本去处理新的上传。
# CallUploadscrīpt yes
# 这个选项对允许匿名上传的服务器是有用的。当 /var/ftp 在 /var 里时,需要保留一定磁盘空间
# 来保护日志文件。当所在磁盘分区使用超过百分之 X 时,将不在接受新的上传。
  MaxDiskUsage              99
# 如果你不想要你的用户重命名文件的话,就设置为 'yes' 。
# NoRename yes
# 是 'customer proof' : 工作区(workaround)反对普通的客户错误,类似于:'chmod 0 public_html' 的错误。
# 那是一个有效的命令,不过,将导致无知的客户所定他们自己的文件,将使你的技术支持忙于愚蠢的的问题中。
# 如果你确信你所有的用户都有基本的Unix知识的话,这个特性将没什么用了。不过,如果你是一个主机提供商
# 的话,启用它。
CustomerProof yes
# 每一个用户的并发限制。只有在添加了 --with-peruserlimits 编译选项进行编译后,这个指令才起
# 作用。(大部分的二进制的发布版本就是例子)
# 格式是 : <每一个用户最大允许的进程>:<最大的匿名用户进程>
# 例如: 3:20 意思是同一个认证用户最大可以有3个同时活动的进程。而且同时最多只能有20个匿名用户进程

pureftpd-mysql.conf

MYSQLSocket     /tmp/mysql.sock
MYSQLServer     localhost
MYSQLPort       3306
MYSQLUser       ftp
MYSQLPassword   123456
MYSQLDatabase   ftpusers
MYSQLCrypt      md5
MYSQLGetPW      SELECT Password FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MYSQLGetUID     SELECT Uid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MYSQLGetGID     SELECT Gid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MYSQLGetDir     SELECT Dir FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MySQLGetQTASZ   SELECT QuotaSize FROM users WHERE User="\L"
MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")

 

--------------------------------------------

# If you want to use the Socket connect methode comment out the
# Lines with MMYSQLServer and MYSQLPort.
# If you want to use the Port methode comment out the MYSQLSocket line
#//IMPORTENT!!!If display 530 error,please check the following MYSQL parameter!!
MYSQLSocket     /tmp/mysql.sock
MYSQLServer     localhost
MYSQLPort       3306
MYSQLUser       ftp
MYSQLPassword   123456
MYSQLDatabase   ftpusers
MYSQLCrypt      md5

# In the following directives, parts of the strings are replaced at
# run-time before performing queries :
#
# \L is replaced by the login of the user trying to authenticate.
# \I is replaced by the IP address the user connected to.
# \P is replaced by the port number the user connected to.
# \R is replaced by the IP address the user connected from.
# \D is replaced by the remote IP address, as a long decimal number.
#
# Very complex queries can be performed using these substitution strings,
# especially for virtual hosting.


# Query to execute in order to fetch the password

MYSQLGetPW      SELECT Password FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")


# Query to execute in order to fetch the system user name or uid

MYSQLGetUID     SELECT Uid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")


# Optional : default UID - if set this overrides MYSQLGetUID

#MYSQLDefaultUID 1000


# Query to execute in order to fetch the system user group or gid

MYSQLGetGID     SELECT Gid FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")

# Optional : default GID - if set this overrides MYSQLGetGID

#MYSQLDefaultGID 1000


# Query to execute in order to fetch the home directory

MYSQLGetDir     SELECT Dir FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")

# Optional : query to get the maximal number of files
# Pure-FTPd must have been compiled with virtual quotas support.

# MySQLGetQTAFS  SELECT QuotaFiles FROM users WHERE User="\L"

# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.

# MySQLGetQTASZ  SELECT QuotaSize FROM users WHERE User="\L"


# Optional : ratios. The server has to be compiled with ratio support.

# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L"


# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .

MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L" AND Status="1" AND (Ipaddress = "*" OR Ipaddress LIKE "\R")

# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
# 2) Real and virtual users match.

# MySQLForceTildeExpansion 1


# If you upgraded your tables to transactionnal tables (Gemini,
# BerkeleyDB, Innobase...), you can enable SQL transactions to
# avoid races. Leave this commented if you are using the
# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.

# MySQLTransactions On

配置vsftp支持ssl

ftp传输数据是明文,弄个抓包软件就可以通过数据包来分析到账号和密码,为了搭建一个安全性比较高ftp,可以结合SSL来解决问题
 
SSL(Secure Socket Layer)工作于传输层和应用程序之间.作为一个中间层,应用程序只要采用SSL提供的一套SSL套接字API来替换标准的Socket套接字,就可以把程序转换为SSL化的安全网络程序,在传输过程中将由SSL协议实现数据机密性和完整性的保证.SSL取得大规模成功后,IETFSSL作了标准化,并将其称为TLS(Transport Layer Security).Ftp结合SSL,将实现传输数据的加密,保证数据不被别人窃取
 
 
让vsftpd支持SSL,必须让OPENSSL≥0.9.6版本,还有就是本身vsftpd版本是否支持
查询vsftpd软件是否支持SSL
[root@localhost vsftpd]# ldd /usr/sbin/vsftpd |grep libssl
        libssl.so.6 => /lib/libssl.so.6 (0xf7f27000)   ==è说明此版本支持
如没有输出libssl.so.6 => /lib/libssl.so.6 (0xf7f27000)类似文本,说明此vsftpd版本不支持SSL


openssl req -x509 -nodes -days 365 -newkey rsa:1024 \-keyout /etc/vsftpd/vsftpd.pem \-out /etc/vsftpd/vsftpd.pem  ==è生成vsftpd.pem 证书

vi /etc/vsftpd/vsftpd.conf  ==è编辑主配置文件,添加以下参数ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem
service vsftpd restart

下面是ssl参数一些定义,根据自己需求去修改
ssl_enable=yes/no             //是否启用 SSL,默认为no
allow_anon_ssl=yes/no         //是否允许匿名用户使用SSL,默认为no
rsa_cert_file=/path/to/file       //rsa证书的位置
dsa_cert_file=/path/to/file      //dsa证书的位置
force_local_logins_ssl=yes/no    //非匿名用户登陆时是否加密,默认为yes
force_local_data_ssl=yes/no     //非匿名用户传输数据时是否加密,默认为yes
force_anon_logins_ssl=yes/no    //匿名用户登录时是否加密,默认为no
force_anon_data_ssl=yes/no     //匿名用户数据传输时是否加密,默认为no
ssl_sslv2=yes/no               //是否激活sslv2加密,默认no
ssl_sslv3=yes/no                //是否激活sslv3加密,默认no
ssl_tlsv1=yes/no                //是否激活tls v1加密,默认yes
ssl_ciphers=加密方法            //默认是DES-CBC3-SHA

 

编译vsftp sysdeputil.c出错的解决办法

specified for parameter 'sendfile'
sysdeputil.c:186: error: storage class specified for parameter 'environ'
sysdeputil.c:187: error: storage class specified for parameter 's_proctitle_space'
sysdeputil.c:187: error: parameter 's_proctitle_space' is initialized
sysdeputil.c:188: error: storage class specified for parameter 's_proctitle_inited'
sysdeputil.c:188: error: parameter 's_proctitle_inited' is initialized
sysdeputil.c:189: error: storage class specified for parameter 's_p_proctitle'
sysdeputil.c:189: error: parameter 's_p_proctitle' is initialized
sysdeputil.c:201: error: storage class specified for parameter 'do_sendfile'
sysdeputil.c:202: error: storage class specified for parameter 'vsf_sysutil_setproctitle_internal'
sysdeputil.c:203: error: storage class specified for parameter 's_proctitle_prefix_str'
sysdeputil.c:278: error: storage class specified for parameter 's_pamh'
sysdeputil.c:279: error: storage class specified for parameter 's_pword_str'
sysdeputil.c:281: error: storage class specified for parameter 'pam_conv_func'
sysdeputil.c:282: error: storage class specified for parameter 'vsf_auth_shutdown'
sysdeputil.c:288: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:383: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:398: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:436: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:474: error: storage class specified for parameter 'do_checkcap'
sysdeputil.c:478: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:497: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:514: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:527: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:604: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:641: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:796: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:803: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:809: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:856: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:889: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:930: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:935: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:976: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1012: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1128: error: storage class specified for parameter 's_uwtmp_inserted'
sysdeputil.c:1129: error: storage class specified for parameter 's_utent'
sysdeputil.c:1134: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1173: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1189: error: old-style parameter declarations in prototyped function definition
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:1189: error: expected '{' at end of input
make: *** [sysdeputil.o] Error 1

 

这几个包可能不是REDHAT的,这个问题的原因是sysdeputil.c 文件出错,真正解决方法是给其打补丁:
# patch sysdeputil.c attachment.bin
  # make
attachment.bin 的位置在:
http://linuxfromscratch.org/pipe ... 9f56/attachment.bin
注明: 当前目录为vsftp**/

Records:1012