proftpd是一款开放源码的ftp服务器软件,它是原来世界范围使用最广泛的wu-ftpd的改进版,它修正了wu-ftpd的许多缺陷,在许多方面进行了重大的改进,其中一个重要变化就是它学习了 Apache 的配置方式,使proftpd的配置和管理更加简单易懂。本文将介绍它在Red hat Linux 9中最基本的安装和配置。
正常情况下proftpd应该启动了,ps aux 应该可以查到proftpd的进程,或netstat -an 也可以看到21端口的服务已经起来了。(ftp默认端口)
如果要设置开机自启动ftp server,只需在/etc/rc.d/rc.local中加入一行
/usr/local/sbin/proftpd
#!/bin/sh
#
# This script will be executed
*after* all the other init scripts.
# You can put your own
initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/usr/local/sbin/proftpd
# 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 "
ServerType
standalone
DefaultServer
on
# Port 21 is the standard FTP port.
Port 21
ServerType 指定FTP Server 的启动类型,一般使用standalone方式比较简单,如果访问量不大,为节省资源考虑用xinetd侦听启动,必须在这里指定。Port 指定FTP的侦听端口,一般使用21端口
# Umask 022 is a good standard
umask to prevent new dirs and files
# from being group and world writable.
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).
MaxInstances 30
Umask 指定FTP server 进程的Umask 值,022与Linux系统得默认值一致。
MaxInstances 指定 FTP server 的最大连接数。
# Set the user and group under
which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be
"jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~
DefaultRoot
User 和Group 指定proftpd 进程启动时的有效用户ID,处于安全考虑默认的身份是nobody,有一点要指出的是,一般Red Linux 9.0 中默认是没有nogroup 这个组的,把Group指定为nobody 即可。
# Set the maximum number of seconds
a data connection is allowed
# to "stall" before being aborted.
#TimeoutStalled 300
AllowRetrieveRestart on
AllowStoreRestart on
# Normally, we want files to be overwriteable.
AllowOverwrite on
TimeoutStalled 指定一个连接的超时时间。
AllowRetriveRestart 和AllowStroeRestart 指定允许断点续传。
User ftp
Group ftp
# 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
这一部分,将在后面详细介绍。
2.配置文件结构分析
#全局设置
设置项目1 参数1
设置项目2 参数2
#某个目录的设置
...
...
#关于匿名登陆的设置
...
...
...
...
常用全局设置
DefaultRoot ~ # 限制每个FTP用户在自己的目录下,不可查看上一级目录
AllowRetrieveRestart on #下载时,允许断点续传
AllowStoreRestart on #上传时,允许断点续传
ServerIdent off #屏蔽服务器版本信息
TransferRate STOR|RETR 速度(Kbytes/s) user 使用者 #设定用户传输速率