pureftpd

本文最后更新于:2023年12月5日 晚上

pure-ftpd.conf

# 限制所有用户在其主目录中,change root directory(更改根目录),参考chroot命令
ChrootEveryone               yes
# 如果前一个指令被设置为了 "no",下面组的成员(GID)就不受主目录的限制了。而其他的用户还是会被限制在自己的主目录里。如果你不想把任何用户限制在自己的主目录里,只要注释掉 ChrootEveryone 和 TrustedGID 就可以了
# TrustedGID                   100
BrokenClientsCompatibility   no # 兼容ie等比较非正规化的ftp客户端
MaxClientsNumber             50 # 服务器总共允许同时连接的最大用户数
Daemonize                    yes # 做为守护(doemon)进程运行(Fork in background)
# 同一IP允许同时连接的用户数(Maximum number of sim clients with the same IP address)
MaxClientsPerIP              8
VerboseLog                   no  # 如果你要记录所有的客户命令,设置这个指令为 "yes"
DisplayDotFiles              yes # 即使客户端没有发送 '-a' 选项也列出隐藏文件
AnonymousOnly                no  # 是否只让匿名用户登录
NoAnonymous                  no  # 不允许匿名连接,仅允许认证用户使用
SyslogFacility               ftp # 缺省的facility 是 "ftp"。 "none" 将禁止日志
# 定制用户登陆后的显示信息(Display fortune cookies)
# FortunesFile                 /usr/share/fortune/zippy
# 在日志文件中不解析主机名。日志没那么详细的话,就使用更少的带宽。在一个访问量很大的站点中,设置这个指令为 "yes" ,如果你没有一个能工作的DNS的话
DontResolve                  yes
MaxIdleTime                  15 # 客户端允许的最大的空闲时间(分钟,缺省15分钟)
# LDAPConfigFile /etc/pureftpd-ldap.conf # LDAP配置文件 (参考README.LDAP)
# MySQLConfigFile /etc/pureftpd-mysql.conf # MySQL配置文件 (参考README.MySQL)
# PGSQLConfigFile /etc/pureftpd-pgsql.conf # Postgres配置文件 (参考README.PGSQL)
# PureDB /etc/pureftpd.pdb # PureDB用户数据库 (参考README.Virtual-Users)
# ExtAuth /var/run/ftpd.sock # pure-authd 的socket 路径(参考README.Authentication-Modules)
# 如果你要启用 PAM 认证方式, 去掉下面行的注释
# PAMAuthentication            yes
# 如果你要启用 简单的 Unix系统 认证方式(/etc/passwd), 去掉下面行的注释,就是允许系统用户登录
# UnixAuthentication           yes
# 'ls' 命令的递归限制。第一个参数给出文件显示的最大数目。第二个参数给出最大的子目录深度
LimitRecursion               10000 8
AnonymousCanCreateDirs       no # 允许匿名用户创建新目录
# 如果系统被 loaded 超过下面的值,匿名用户会被禁止下载
MaxLoad                      4
# PassivePortRange             30000 50000 # 被动连接响应的端口范围
# ForcePassiveIP               192.168.0.1 # 强制一个IP地址使用被动响应
# AnonymousRatio               1 10  # 匿名用户的上传/下载的比率
# UserRatio                    1 10  # 所有用户的上传/下载的比率
# 不接受所属者是 "ftp" 的文件的下载。例如:那些匿名用户上传后未被本地管理员验证的文件
AntiWarez                    yes
# Bind                         127.0.0.1,21 # 服务监听的IP 地址和端口。(缺省是所有IP地址和21端口)
# AnonymousBandwidth           8 # 匿名用户的最大带宽(KB/s)
# UserBandwidth                8 # 所有用户的最大带宽(KB/s),包括匿名用户
# 新建目录及文件的属性掩码值:<文件掩码>:<目录掩码>,如果不放心,就直接设置177:077
Umask                        133:022
MinUID                       100 # 认证用户允许登陆的最小组ID(UID)
AllowUserFXP                 no  # 仅允许认证用户进行 FXP 传输
AllowAnonymousFXP            no  # 对匿名用户和非匿名用户允许进行匿名 FXP 传输
# 用户不能删除和写点文件(以 '.' 开头的文件),即使用户是文件的所有者也不行
ProhibitDotFilesWrite        no
# 禁止读点文件(文件名以 '.' 开头的文件)
ProhibitDotFilesRead         no
# 永不覆盖文件。当上传的文件,其文件名已经存在时,自动重命名,如: file.1, file.2, file.3, ...
AutoRename                   no
AnonymousCantUpload          no  # 不接受匿名用户上传新文件( 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
# NoChmod                      yes # 不接受 chmod 命令。用户不能更改他们文件的属性
# 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就能读然后调用一个脚本去处理新的上传
# CallUploadScript             yes
# 这个选项对允许匿名上传的服务器是有用的。当 /var/ftp 在 /var 里时,需要保留一定磁盘空间来保护日志文件。当所在磁盘分区使用超过百分之 X 时,将不在接受新的上传
MaxDiskUsage                   99
# NoRename                     yes # 如果你不想要你的用户重命名文件的话,就设置为 'yes'
# 如果你所有的用户都有基本的Unix知识的话,这个特性将没什么用了。不过,如果你是一个主机提供商的话,启用它
CustomerProof                yes
# 每一个用户的并发限制。只有在添加了 --with-peruserlimits 编译选项进行编译后,这个指令才起作用。(大部分的二进制的发布版本就是例子),格式是 : <每一个用户最大允许的进程>:<最大的匿名用户进程>,例如: 3:20 意思是同一个认证用户最大可以有3个同时活动的进程。而且同时最多只能有20个匿名用户进程
# PerUserLimits                3:20

# NoTruncate                   yes
# TLS                          1
# TLSCipherSuite               HIGH
# CertFile                     /etc/ssl/private/pure-ftpd.pem
# CertFileAndKey               "/etc/pure-ftpd.pem" "/etc/pure-ftpd.key"
# ExtCert                      /var/run/ftpd-certs.sock
# IPV4Only                     yes
# IPV6Only                     yes

请注意:LDAPConfigFile, MySQLConfigFile, PAMAuthentication 和 UnixAuthentication 这些指令只能被使用一次,不过,他们能被混合在一起用。例如:如果你使用了 MySQLConfigFile 和 UnixAuthentication,那么 SQL 服务器将被访问。如果因为用户名未找到而使 SQL 认证失败的话,就会在/etc/passwd 和 /etc/shadow 中尝试另外一种认证,如果因为密码错误而使 SQL 认证失败的话,认证就会在此结束了。认证方式由它们被给出来的顺序而被链接了起来

命令

lujinkai@Z510:/usr/local/pureftpd$ ll bin/ sbin/
bin/:
总用量 100
drwxr-xr-x 2 root root  4096 1111 11:04 ./
drwxr-xr-x 6 root root  4096 1111 11:04 ../
-rwxr-xr-x 1 root root 50248 1111 11:04 pure-pw*
-rwxr-xr-x 1 root root 17400 1111 11:04 pure-pwconvert*
-rwxr-xr-x 1 root root 17416 1111 11:04 pure-statsdecode*

sbin/:
总用量 364
drwxr-xr-x 2 root root   4096 1111 11:04 ./
drwxr-xr-x 6 root root   4096 1111 11:04 ../
-rwxr-xr-x 1 root root  17200 1111 11:04 pure-authd*
-rwxr-xr-x 1 root root  28320 1111 11:04 pure-certd*
-rwxr-xr-x 1 root root 213928 1111 11:04 pure-ftpd*
-rwxr-xr-x 1 root root  17248 1111 11:04 pure-ftpwho*
-rwxr-xr-x 1 root root  17424 1111 11:04 pure-mrtginfo*
-rwxr-xr-x 1 root root  27768 1111 11:04 pure-quotacheck*
-rwxr-xr-x 1 root root  27904 1111 11:04 pure-uploadscript*
lujinkai@Z510:
lujinkai@Z510:/usr/local/pureftpd$ ll share/man/man8/
总用量 84
drwxr-xr-x 2 root root  4096 1111 11:04 ./
drwxr-xr-x 3 root root  4096 1111 11:04 ../
-rw-r--r-- 1 root root  4146 1111 11:04 pure-authd.8
-rw-r--r-- 1 root root  2889 1111 11:04 pure-certd.8
-rw-r--r-- 1 root root 29533 1111 11:04 pure-ftpd.8
-rw-r--r-- 1 root root  2425 1111 11:04 pure-ftpwho.8
-rw-r--r-- 1 root root  2101 1111 11:04 pure-mrtginfo.8
-rw-r--r-- 1 root root  3280 1111 11:04 pure-pw.8
-rw-r--r-- 1 root root   781 1111 11:04 pure-pwconvert.8
-rw-r--r-- 1 root root  2164 1111 11:04 pure-quotacheck.8
-rw-r--r-- 1 root root  1125 1111 11:04 pure-statsdecode.8
-rw-r--r-- 1 root root  4156 1111 11:04 pure-uploadscript.8

pure-pw

Manage virtual users files for Pure-FTPd.

Virtual users is a simple mechanism to store a list of users, with their password, name, uid, directory, etc. It’s just like /etc/passwd. But it’s not /etc/passwd. It’s a different file, only for FTP.
It means that you can easily create FTP-only accounts without messing your system accounts.
Additionnaly, virtual users files can store individual quotas, ratios, bandwidth, etc. System accounts can’t do this.
Thousands of virtual users can share the same system user, as long as they all are chrooted, and they have their own home directory.

pure-pwconvert

Generate a virtual users file from system accounts.

This program scans system accounts (/etc/passwd) and outputs a FTP virtual users list, suitable to the pure-pw command.

pure-statsdecode

Show human-readable dates from a “stats” logfile.

This program decodes Pure-FTPd’s “stats” log files and converts timestamps into human-readable dates.

pure-authd

External authentication agent for Pure-FTPd

pure-authd is a daemon that forks an authentication program, waits for an authentication reply, and feed them to an application server.
pure-authd listens to a local Unix socket. A new connection to that socket should feed pure-authd the following structure:
​ account:xxx
​ password:xxx
​ localhost:xxx
​ localport:xxx
​ peer:xxx

pure-certd

TLS certificate agent for Pure-FTPd.

pure-certd is a daemon that forks an authentication program, waits for a certificate path as a reply, and returns it to an application server.
pure-certd listens to a local Unix socket. A new connection to that socket should send pure-authd the following structure:
sni_name:xxx end
These content is passed to the authentication program, as an environment variable:
CERTD_SNI_NAME
The authentication program should take appropriate actions to select a TLS certificate, and reply to the standard output with the fol‐lowing format:
action:strict cert_file:/path/to/cert.pem key_file:/path/to/cert.pem end

pure-ftpd

simple File Transfer Protocol server

Pure-FTPd is a small, simple server for the old and hairy File Transfer Protocol, designed to use less resources than older servers,be smaller and very secure, and to never execute any external program.
It support most-used features and commands of FTP (including many modern extensions), and leaves out everything which is deprecated,meaningless, insecure, or correlates with trouble.
IPv6 is fully supported.

pure-ftpwho

Report current FTP sessions.

pure-ftpwho shows current Pure-FTPd client sessions. Only the system administrator may run this. Output can be text (default), HTML, XML data and parser-optimized. The server has to be compiled with –with-ftpwho to support this command.

pure-mrtginfo

provide an MRTG-graphable user count for ftpd.

Pure-Mrtginfo counts the number of clients currently connected to ftpd(8) and output the format in a format graphable by MRTG.

pure-quotacheck

Update virtual quota files for Pure-FTPd.

pure-quotacheck create a .ftpquota file in the specified directory.
This file contains the current file and size of the directory, and it is used by Pure-FTPd when virtual quotas are enabled.
It’s recommended to periodically run pure-quotacheck for every user, in crontabs.

pure-uploadscript

Automatically run an external program after a successful upload.

If Pure-FTPd is compiled with –with-uploadscript (default in binary distributions), and if the -o (or –uploadscript) is passed to the server, a named pipe called /var/run/pure-ftpd.upload.pipe is created. You will also notice an important file called /var/run/pure-ftpd.upload.lock, used for locking.
After a successful upload, the file name is written to the pipe.
pure-uploadscript reads this pipe to automatically run any program or script to process the newly uploaded file.


pureftpd
http://blog.lujinkai.cn/运维/网络文件共享/pureftpd/
作者
像方便面一样的男子
发布于
2020年12月9日
更新于
2023年12月5日
许可协议