pure-ftpd 修改上传权限

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

档案 600  目录 700
这对权限控管很好用 , 但如果针对网页主机而言的话就不见得 ,  因网页至少需要 644 甚至 666 才能正常开啟网页
更改 /etc/pure-ftpd/pure-ftpd.conf
找到约
237 行Umask                       177:077
修改為
Umask                       133:033 
即上传后為 档案644 目录744

如上传后权限要设為 655 755 的话 Umask 就设 122 022

/etc/init.d/pure-ftpd          管理 FTP 服务的 script。
/etc/pure-ftpd/pure-ftpd.conf         pure-ftpd 的主要设定档。
/etc/xinetd.d/pure-ftpd         pure-ftpd 可以使用 inetd 的方式来啟动噢,不过预设是 standalone 啦。
/usr/bin/pure-pw         管理虚拟帐号时所使用的指令。
/usr/sbin/pure-ftpd         FTP 服务的主要执行程式,就是那个监听 21 port 的 daemon 萝。
/usr/sbin/pure-ftpwho         这个指令可以用来查询目前谁在线上。
/usr/sbin/rcpure-ftpd         连结至 /etc/init.d/pure-ftpd 的符号连结档。


设定 pure-ftpd.conf
suselinux:~ # vi /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
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值