荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: kisky (好男儿), 信区: Linux
标  题: 如何把wu-ftpd换成ProFTPD[fwd]
发信站: 荔园晨风BBS站 (Fri Jun 15 00:18:26 2001), 站内信件

【 以下文字转载自 kisky 的信箱 】
【 原文由 kisky.bbs@bbs.nju.edu.cn 所发表 】
发信人: xiyang (APACHE VS IIS), 信区: LinuxUnix
标  题: 如何把wu-ftpd换成ProFTPD[fwd]
发信站: 南京大学小百合站 (Thu Jun 14 20:07:42 2001), 站内信件

[转载自:www.fanqiang.com]
Copyright 2001 OLS3,本讲义仅供教育人员参考,任何引用,请先取得作者的同意.
Email: ols3@www.tnc.edu.tw
网站: http://www.ols3-cgi.com 或 http://www.perl.ms 卧龙小三CGI天堂
或 http://perl.tnc.edu.tw/
注意! 本文件编写时, proftpd 的版本是 1.2.0rc2, 不过, 目前您至少要用 1.2.0rc3
 以上的版本才好! 建议用 1.2.2rc1 ! (04/14/2001)
一. Say something ....
虽然,目前,大多数站台的 FTP 服务,以采用 WU-FTPD 伺服器程式架设者居多,而且
WU-FTPD 在效能上,一直有不错的表现,程式版本更新的速度也不慢,不过,它却不是
一个够安全的系统,(我手头上至少有十数程式是用来攻击 WU-FTPD 的),过去以来,
它一直有着一段很不名誉的安全漏史。
因此之故,许多网管人员总是想把 WU-FTPD 换掉.......
如果您想找一个不错的 FTP 伺服程式来取代 WU-FTPD,试试 ProFTPD 吧!
ProFTPD 的发展,一开始,便是定位在:成为一个安全且容易设定的 FTP 伺服器程式。

虽然目前使用 ProFTPD 的站台数量 ,不比 WU-FTPD 多,但它的风格及表现,却深得许
多网管人员的喜爱。
以下是 ProFTPD 的特点:
单一设定档,设定风格接近 Apache 设定档
每一目录可用 .ftpaccess 来控制(类似 Apache 的 .htaccess)
易於设定多重虚拟主机以及匿名FTP
可让管理人员选择 standalone 或 inetd 的执行方式
匿名FTP不需要额外的目录结构
原始码开放,没有 SITE EXEC 指令,安全性可受监控
根据系统档案权限,可隐藏目录或档案
以较低权限的身份来执行,降低万一被攻入的危险
记录档支援 utmp/wtmp,并和 wu-ftpd 相容,记录格式也可扩充
支援 shadow password
二. 开始安装吧!
先移除匿名 FTP
rpm -e anonftp
再移除 WU-FTPD
rpm -e wu-ftpd
* 请放心,您放在 /home/ftp/pub 下的档案,不会不见啦!
(除非您是新装 WU-FTPD 而 /home/ftp/pub 尚未放入任何档案)
ProFTPD 下载区
ftp://ftp.tnc.edu.tw/pub/Sysop/FTP

http://www.profptd.net
选择 ProFTPD 的下载版本
共有三种情况,各有二种安装方式:standalone 或 inetd
a. 若您是 RedHat 6.1 + CLE 0.9 以前
若您打算采用 standalone 的执行方式,请抓取 proftpd-core-1.2.0pre10-1CLE.i386
.rpm 及 proftpd-standalone-1.2.0pre10-1CLE.i386.rpm
若您打算采用 inetd 的执行方式,请抓取 proftpd-core-1.2.0pre10-1CLE.i386.rpm
及 proftpd-inetd-1.2.0pre10-1CLE.i386.rpm
b. 若您是 RedHat 6.2 + CLE 0.9p1-1
若您打算采用 standalone 的执行方式,请抓取 proftpd-core-1.2.0rc2-2CLE.i386.r
pm 及 proftpd-standalone-1.2.0rc2-2CLE.i386.rpm
若您打算采用 inetd 的执行方式,请抓取 proftpd-core-1.2.0rc2-2CLE.i386.rpm 及
 proftpd-inetd-1.2.0rc2-2CLE.i386.rpm
c. 若您是 RedHat 英文版
请抓取 proftpd-1.2.0rc2-2.i386.rpm 或 proftpd-1.2.0rc2.tar.gz
安装 ProFTPD
(1) RedHat 6.1 + CLE 0.9 + standalone执行方式
rpm -ivh proftpd-core-1.2.0pre10-1CLE.i386.rpm
(或 rpm -ivh proftpd-core*.rpm)
rpm -ivh proftpd-standalone-1.2.0pre10-1CLE.i386.rpm
(或 rpm -ivh proftpd-standalone*.rpm)
(2) RedHat 6.1 + CLE 0.9 + inetd 执行方式
rpm -ivh proftpd-core-1.2.0pre10-1CLE.i386.rpm
(或 rpm -ivh proftpd-core*.rpm)
rpm -ivh proftpd-inetd-1.2.0pre10-1CLE.i386.rpm
(或 rpm -ivh proftpd-inetd*.rpm)
(3) RedHat 6.2 + CLE 0.9p1-1 + standalone执行方式
rpm -ivh proftpd-core-1.2.0rc2-2CLE.i386.rpm
(或 rpm -ivh proftpd-core*.rpm)
rpm -ivh proftpd-standalone-1.2.0rc2-2CLE.i386.rpm
(或 rpm -ivh proftpd-standalone*.rpm)
(4) RedHat 6.2 + CLE 0.9p1-1 + inetd 执行方式
rpm -ivh proftpd-core-1.2.0rc2-2CLE.i386.rpm
(或 rpm -ivh proftpd-core*.rpm)
rpm -ivh proftpd-inetd-1.2.0rc2-2CLE.i386.rpm
(或 rpm -ivh proftpd-inetd*.rpm)
(5) RedHat 英文版
rpm -ivh proftpd-1.2.0rc2-2.i386.rpm

tar xvzf proftpd-1.2.0rc2.tar.gz
cd proftpd-1.2.0rc2
./configure --enable-shadow
make
make install
ProFTPD 设定档的位
用 RPM 档安装的 ProFTPD 设定档在 /etc/proftpd.conf
若您是抓 tar.gz 档回来安装的,则设定档在 /usr/local/etc/proftpd.conf
设定 ProFTPD
以下是 proftpd.conf 的设定例(采用 standalone):
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
# ServerName : 设定您的站台名称
ServerName "OLS3.com"# ServerType : 设定 ProFTPD 的执行方式,可以是 standalon
e 或 inetd
ServerType standalone# DefaultServer 用来设定 unknown 的连接是否由预设的主机
来处理
DefaultServer on
# Port 21 is the standard FTP port.
# Port 21 是 FTP 标准的通道
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.# 档案安全滤网值设为 022
Umask 022
# 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)# 可避免 DoS 攻击的设定(只限standalone的执行方式)
MaxInstances 30
# Set the user and group that the server normally runs at.# 执行时的身份/组别
权限
User nobody
Group nobody
# Normally, we want files to be overwriteable.
  AllowOverwrite on
# A basic anonymous configuration, no upload directories.# 以下是匿名 FTP 的
设定
  User ftp
  Group ftp
  AnonRequirePassword           off
  RequireValidShell             off
  # 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
    DenyAll
修改 /etc/inetd.conf
若您打算采用 standalone 的方式来执行,则,尚需修改 /etc/inetd.conf
将其中的 ftp 设定关掉,即:
ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
改成
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
启动 ProFTPD
/etc/rc.d/init.d/proftpd start
采用 inetd 执行时的设定方式 (我喜欢用这种模式,但你不必非得和我一样)
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
# ServerName : 设定您的站台名称
ServerName "OLS3.com"# ServerType : 设定 ProFTPD 的执行方式,可以是 standalon
e 或 inetd# 此处是 inetd
ServerType inetd# DefaultServer 用来设定 unknown 的连接是否由预设的主机来处理

DefaultServer on
# Port 21 is the standard FTP port.
# Port 21 是 FTP 标准的通道
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.# 档案安全滤网值设为 022
Umask 022
# 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)# 可避免 Dos 攻击的设定(只限standalone的执行方式)
MaxInstances 30
# Set the user and group that the server normally runs at.# 执行时的身份/组别
权限
User nobody
Group nobody
# Normally, we want files to be overwriteable.
  AllowOverwrite on
# A basic anonymous configuration, no upload directories.# 以下是匿名 FTP 的
设定
  User ftp
  Group ftp
  AnonRequirePassword           off
  RequireValidShell             off
  # 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
    DenyAll
若您是采用 inetd 的执行方式,则必须修改 /etc/inetd.conf 的设定:

ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
改成
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
ftp stream tcp nowait root /usr/sbin/tcpd in.proftpd

#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
ftp stream tcp nowait root /usr/sbin/tcpd proftpd
存档之後,重新启动 inetd :
/etc/rc.d/init.d/inet restart
注意事项
a. 若您想限制 FTP 登入的使用者,使他无法切换到别人的自家目录(Home Directory)
,可在 proftpd.conf 中加上:
 DefaultRoot ~
b. 若您发现使用 WS_FTP 等软体连上FTP时,无法改变档案属性,可在 proftpd.conf
中加上:
 AllowChmod  true
(注意: 必须是 rc1 以後的版本才适用, pre10之前不行!)
c. 若您发现使用匿名ftp登入时出现错误,大概是 /home/ftp/pub这个目录没有开设,

或者,忘了在 proftpd.conf 中加上 RequireValidShell off
d. 若您想将匿名 ftp 关掉,只要将 到 这一段设定用 # 把它mark起来或直接删除即可

e. 若您是抓 tar.gz 自行编译, 则必须自行手动在 /etc/pam.d/ftp 中加入以下PAM设
定(for RedHat Linux)
(假定 /etc/pam.d/ftp不存在,或其中无以下设定的话):
auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/f
tpusers onerr=succeed
auth required /lib/security/pam_pwdb.so shadow nullok
account required /lib/security/pam_pwdb.so
session required /lib/security/pam_pwdb.so
f. 其它常见的问题,请看 FAQ
g. 各项设定命令,请参考 List of configuration directives
h. 使用手册:http://hamster.wibble.org/proftpd/(国外) or 本站 (线上电子书)
i. 原始站台:http://www.proftpd.net
绝对安全性???
当然,没有一套系统是绝对安全的,ProFTPD 也不例外,不过,依据各项私下的测试,
ProFTPD 在这方面确实比 WU-FTPD 出色。
请您量试试吧?! ^_^

--
欲道不相思,相思令人老,几番细思量,还是相思好。

※ 来源:.南京大学小百合站 bbs.nju.edu.cn.[FROM: socks.nju.edu.cn]
--
※ 转寄:.南京大学小百合站 bbs.nju.edu.cn.[FROM: 深圳大学BBS]
--
※ 转载:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.178]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店