探索,發現,愛好、學習,記錄,分享。
學海無涯,天涯若比鄰,三人行,必有我師。

Pure-FTP一些配置参数

ChrootEveryone yes #限制所有用户在其主目录中
 
BrokenClientsCompatibility no #兼容ie等比较非正规化的ftp客户端
 
MaxClientsNumber 50 #服务器总共允许同时连接的最大用户数
 
Daemonize yes #做为守护(doemon)进程运行(Fork in background)
 
MaxClientsPerIP 8 #同一IP允许同时连接的用户数
 
VerboseLog no #如果你要记录所有的客户命令,设置这个指令为 "yes"
 
DisplayDotFiles yes #即使客户端没有发送 '-a' 选项也列出隐藏文件
 
AnonymousOnly no #不允许认证用户 - 仅作为一个公共的匿名FTP。
 
NoAnonymous yes #不允许匿名连接,仅允许认证用户使用。
 
SyslogFacility ftp #缺省的功能( facility )是 "ftp"。 "none" 将禁止日志。
 
DontResolve yes #在日志文件中不解析主机名。
 
MaxIdleTime 15 #客户端允许的最大的空闲时间(分钟,缺省15分钟)
 
PureDB /usr/local/pureftp-1.0.22/etc/pureftpd.pdb #PureDB 用户数据库
 
LimitRecursion 2000 8 #'ls' 命令的递归限制。第一个参数给出文件显示的最大数目。第二个参数给出最大的子目录深度。
 
AnonymousCanCreateDirs no #允许匿名用户创建新目录?
 
MaxLoad 4 #如果系统被 loaded 超过下面的值,匿名用户会被禁止下载。
 
AntiWarez yes #不接受所有者为 "ftp" 的文件的下载。
 
Bind 10.10.10.10,21 #服务监听的IP 地址和端口。
 
Umask 133:022 #新建目录及文件的属性掩码值。<文件掩码>;:<目录掩码>; .
 
MinUID 99 #认证用户允许登陆的最小组ID(UID) 。
 
AllowUserFXP yes #仅允许认证用户进行 FXP 传输。
 
AllowAnonymousFXP no #对匿名用户和非匿名用户允许进行匿名 FXP 传输。
 
ProhibitDotFilesWrite no #用户不能删除和写点文件(文件名以 '.' 开头的文件)
 
ProhibitDotFilesRead no #禁止读点文件(文件名以 '.' 开头的文件) (.history, .ssh...)
 
AutoRename no #永不覆盖文件。当上传的文件,其文件名已经存在时,自动重命名,如: file.1, file.2, file.3, ...
 
AnonymousCantUpload no #不接受匿名用户上传新文件( no = 允许上传)
 
AltLog clf #使用类似于Apache的格式创建一个额外的日志文件
 
MaxDiskUsage 99 #来保护日志文件。当所在磁盘分区使用超过百分之 X 时,将不在接受新的上传。
 
CustomerProof yes
 
UnixAuthentication no #不起用 简单的 Unix系统 认证方式(/etc/passwd)。

我们安装完pure-ftpd之后,上传文件后发现路径权限为:-rw-r--r--,那么当我们执行php脚本时,会显示:403 Forbidden,那么我们必须重新配置pure-ftpd的上传权限。

pure-ftpd 预设上传权限为:

档案 600 目录 700

这对权限控管很好用 , 但如果针对网页主机而言的话就不见得,因网页至少需要 644 甚至 666 才能正常开启网页

找到pure-ftpd的配置文件: /etc/pure-ftpd/pure-ftpd.conf

# Cage in every user in his home directory

ChrootEveryone    yes

# 限定每一个使用者都只能在自己家目录下活动。当设定成 no 时,则 Real User 可切换至其他

# 目录做存取。

# If the previous option is set to "no", members of the following group won't be caged. Others will be.

# If you don't want chroot()ing anyone,just comment out ChrootEveryone and TrustedGID.

# TrustedGID     100

# 当您将註解拿掉后,GID 100 的群组成员会被视為信任的使用者,因此可以存取家目录外的

# 其他目录。此时无论 ChrootEveryone 设定為何,都是一样的结果。

# Maximum number of simultaneous users

MaxClientsNumber   10

# 限定最大连线数為 10。

# Maximum number of sim clients with the same IP address

MaxClientsPerIP     3

# 限定同一来源端位址的最大连线数為 3。

# List dot-files even when the client doesn't send "-a".

DisplayDotFiles     yes

# 这个参数设定成 yes 的话,则 Client 可以看到档名是以 "." 作开始的隐藏档。

# Don't allow authenticated users - have a public anonymous FTP only.

AnonymousOnly    yes

# 是否只允许匿名登入。当您希望 Real User 也能登入时,就设定成 no。

# Disallow anonymous connections. Only allow authenticated users.

NoAnonymous     no

# 是否不允许匿名登入。当设定成 no,表示允许匿名登入,但如果您希望只有 Real User 能经

# 由认证登入时,这裡就设定成 yes 吧。

# Syslog facility (auth, authpriv, daemon, ftp, security, user, local*)

# The default facility is "ftp". "none" disables logging.

SyslogFacility     ftp

# 您可以在 /etc/syslog.conf 裡使用 ftp 这个 facility,来告知 syslogd 要将 ftp 的相关讯息纪录到

# 哪裡,比如: ftp.*   /var/log/ftplog

# Don't resolve host names in log files. Logs are less verbose, but it uses less bandwidth. Set this to "yes"

# on very busy servers or if you don't have a working DNS.

DontResolve      yes

# ftp 的纪录档是否不需解析主机名称。

# Maximum idle time in minutes (default = 15 minutes)

MaxIdleTime      15

# 设定 FTP Client 端的閒置时间為 15 分鐘。

# PureDB user database (see README.Virtual-Users)

# PureDB   /etc/pure-ftpd/pureftpd.pdb

# 这是使用虚拟帐号登入时,所指定要使用的资料库。

# If you want to enable PAM authentication, uncomment the following line.

PAMAuthentication    yes

# 是否使用 PAM 认证模组来对使用者作认证。

# If you want simple Unix (/etc/passwd) authentication, uncomment this.

# UnixAuthentication  yes

# 是否依照传统的 /etc/passwd 来做认证。

# Are anonymous users allowed to create new directories ?

AnonymousCanCreateDirs  no

# 是否允许 anonymous 建立新目录。如设定成 yes,则 anonymous 虽可建立目录,但无法删除。

# Port range for passive connections replies. - for firewalling.

# PassivePortRange 30000 50000

# 当 Client 端採用被动模式来建立资料通道时,FTP Server 预计所要使用 data channel 连接埠的范围。

# 当您 Linux Client 端执行 ncftp 或 ftp 指令连上 FTP 站台后,可使用 passive 指令来变更连线模式。

# Upload/download ratio for anonymous users.

# AnonymousRatio   1 10

# 设定 anonymous 上传/下载比率。

# 以 1:10 而言,如果 anonymous 上传了 1MB 的资料后,就能够下载 10MB 的档案资料。

# Upload/download ratio for all users. This directive superscedes the previous one.

# UserRatio      1 10

# 设定 All User 上传/下载比率。当 AnonymousRatio 及 UserRatio 都做设定时,是以 UserRatio 為主。

# Disallow downloading of files owned by "ftp", ie.

# files that were uploaded but not validated by a local admin.

AntiWarez       yes

# 匿名使用者要下载的档案,如果其拥有者是 ftp 的话,则不允许下载。当您的 FTP 站台开放 anonymous 上传时 (上

# 传之后的档案拥有者為 ftp),為了防止有些人会上传一些有问题的档案来供人下载,因此才设定这个参数 ; 而等

# 管理者确认上传的档案没问题后,就可以把此档的拥有者做个改变,这样就能提供正常下载了。

# IP address/port to listen to (default=all IP and port 21).

# Bind       127.0.0.1,21

# 设定 FTP Server 要在哪个介面位址监听哪个 port。预设是允许在所有介面位址监听 21 port。

# Maximum bandwidth for anonymous users in KB/s

# AnonymousBandwidth 8

# 设定 anonymous 最大上传、下载频宽,单位為KB/s。

# Maximum bandwidth for *all* users (including anonymous) in KB/s.

# Use AnonymousBandwidth *or* UserBandwidth, both makes no sense.

# UserBandwidth    8

# 设定 All User 最大上传、下载频宽。当 AnonymousBandwidth 及 UserBandwidth 都设定时,是以 UserBandwidth 為主。

# File creation mask. <umask for files>:<umask for dirs> . 177:077 if you feel paranoid.

Umask        177:077

# 设定上传档案、目录 (含建立新目录) 的预设权限,177:077 表示档案的预设权限為 600,目录為 700。

# Minimum UID for an authenticated user to log in.

MinUID        100

# 设定能允许 Real User 认证登入的最小 UID 為 100,也就是说 UID 100 以上 (含100) 的使用者方可认证登入。

# 如您欲允许 root 登入的话,这个地方请註解起来,并且在 /etc/ftpusers 档案中将 root 帐号移除。

# /etc/ftpusers 是用来设定拒绝登入 FTP Server 的使用者名单的。

# Users can't delete/write files beginning with a dot ('.') even if they own them. If TrustedGID is enabled,

# this group will have access to dot-files, though.

ProhibitDotFilesWrite   yes

# 是否要禁止使用者删除或修改隐藏档,即使使用者就是该隐藏档的拥有者。设定 yes 就表示要禁止啦。

# Prohibit *reading* of files beginning with a dot (.history, .ssh...)

ProhibitDotFilesRead  no

# 是否要禁止使用者读取隐藏档内容。当以上两个参数都设定 no 时,表示使用者对隐藏档具有 r 及 w 的权限 (anonymous

# 為例外)。当 ProhibitDotFilesWrite 设定成 no,而 ProhibitDotFilesRead 设定成 yes 时,使用者是不能删除档案的。但是无论

# 如何设定,只要 TrustedGID 有设定时,则此群组的成员认证进来后是可以具有 r 及 w 的权限,并不会受到这裡的规范。

# Never overwrite files. When a file whoose name already exist is uploaded,

# it get automatically renamed to file.1, file.2, file.3, ...

AutoRename       yes

# 当上传档案时,若对方目录内已经存在一个同档名的档案,则允许将上传的那个档案作自动更名的动作。

# Disallow anonymous users to upload new files (no = upload is allowed)

AnonymousCantUpload yes

# 是否要拒绝 anonymous 上传。如要开放匿名使用者上传档案的话,就设定成 no。另外要允许上传目录时,除了这裡要

# 设定成 no 以外,AnonymousCanCreateDirs 参数需设定成 yes 才行。

# Disallow the CHMOD command. Users can't change perms of their files.

#NoChmod       yes

# 是否要拒绝使用者执行 chmod 指令来修改权限。

# Allow users to resume and upload files, but *NOT* to delete them.

#KeepAllFiles     yes

# 当设定成 yes 时,表示使用者无法删除伺服器上的档案。

# Automatically create home directories if they are missing

#CreateHomeDir    yes

# 当使用者家目录不存在,是否要自动建立起来。

# This option is useful with servers where anonymous upload is allowed. As /var/ftp is in /var, it save some

# space and protect the log files. When the partition is more that X percent full,new uploads are disallowed.

MaxDiskUsage     99

# 假使我们将 anonymous 的家目录改成 /var/ftp (修改 /etc/passwd ),然后又设定允许匿名使用者上传,那这个参数就很好用

# 了,因為当 /var partition 的使用空间达 99% 时,就不允许匿名使用者再上传资料,不然 /var/log 目录下的那些记录档可就

# 无法持续记录一些重要资讯了。

# Set to 'yes' if you don't want your users to rename files.

NoRename        yes

# 是否要拒绝使用者修改档案目录的名称 (重新命名)。

 

版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權
轉載事宜:如需轉載需徵得應允,轉載必須注明來源於本站的信息。
文章名称:《Pure-FTP一些配置参数》
文章链接:https://www.thefreesky.com/blog/27447.html
本站資源僅供個人學習交流,請於下載後24小時內刪除,不允許用於商業用途,否則法律問題自行承擔。

評論 抢沙发