proftpd的配置需求:
1 不允许匿名访问。
2 开放一个帐号,只有在upload目录有上传权限,可以续传,不能改名和删除。
操作:
0 切换到root帐户
# su root //输入root的密码。
#
1 下载proftpd
地址:www.proftpd.org。下载了1.2.9版本
2 安装proftpd
切换到下载目录,假设为/tmp/proftpd,然后
3 新建ftp专用帐号
就是上面目的中提到的那个专用帐号,这里以skate/skate(u/p)为例。
4 设置proftpd
proftpd的配置文件就一个,就是/etc/proftpd.conf
# vi /etc/proftpd.conf //打开proftpd.conf
#
[code:1:de92f96787]
####具体配置如下######
ServerName "Test ftp server..."
ServerType standalone
DefaultServer on
#端口
Port21
Umask 022
#最大线程数
MaxInstances 30
Userskate
Group skate
#DNS反查
UseReversedNS off
IdentLookups off
#最大尝试连接次数
MaxLoginAttempts 3
#每用户线程
MaxClientsPerHost 2
#最大用户数
MaxClients 20
DirFakeUser On skate
DirFakeGroup On skate
DeferWelcome On
#日志文件位置
SystemLog /var/log/proftpd.log
ServerIdent off
#限制skate组的skate用户登录时不能切换到其他目录(只能呆在他的home目录)
DefaultRoot ~ skate,skate
#设置只允许192.168.0的用户登录
#<limit LOGIN>
#Order allow,deny
#Allow from 192.168.0.
#Deny from all
#</limit>
#设置只允许skate用户登录,否则系统用户也可以登录ftp
#<limit LOGIN>
#Order allow,deny
#DenyUser !skate
#</limit>
#开起全盘的写权限
<Directory />
AllowOverwrite on
AllowStoreRestart on
#允许FXP
# AllowForeignAddress on
<Limit All>
AllowAll
</Limit>
</Directory>
#设置skate用户在upload的限制
#DELE删除权限
#RNFR RNTO重命名权限
#RMD XRMD移动目录权限
<Directory /var/ftp/upload>
<Limit DELE RNFR RNTO RMD XRMD >
DenyUser skate
</Limit>
</Directory>
#####结束######
#
编辑完以后按Esc,然后输入:x保存。
5 启动服务
编辑一个启动脚本(这个是从网上copy的,不是我写的,感谢那个写这个脚本的人,很好用,thx)
# vi /etc/rc.d/init.d/proftpd#
#!/bin/sh
#
# Startup script for ProFTPD
#
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server with
#a focus toward simplicity, security, and ease of configuration.
#It features a very apache-like configuration syntax,
#and a highly customizable server infrastructure,
#including support for multiple 'virtual' FTP servers,
#anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
# By: Osman Elliyasa <osman@Cable.EU.org>
# $Id: proftpd.init.d,v 1.7 2002/12/07 21:50:27 jwm Exp $
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi
#下面这行设置环境变量,注意设置好你的proftpd的安装目录
PATH="$PATH:/usr/local/sbin:/var/proftpd/bin:/var/proftpd/sbin"
# See how we were called.
case "$1" in
start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd
;;
stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd
;;
status)
status proftpd
;;
restart)
$0 stop
$0 start
;;
reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo
;;
suspend)
hash ftpshut >/dev/null 2>&1
if [ $? = 0 ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with '$*' "
ftpshut $*
else
echo -n "Suspending NOW "
ftpshut now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo
;;
resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo
;;
*)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
hash ftpshut
if [ $? = 1 ]; then
echo '}'
else
echo '|suspend}'
echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
fi
exit 1
esac
if [ $# -gt 1 ]; then
shift
$0 $*
fi
exit 0
按Esc,输入:x保存。
然后,添加到系统服务并启动
重启proftpd:
6 一点体会
proftpd的文档:
Finally, a special command is allowed which can be used to control login access: LOGIN Connection or login to
the server. Applying a <Limit> to this pseudo-command can be used to allow or deny initial connection or login to the context. It has no
effect, and is ignored, when used in a context other than server config, <VirtualHost> or <Anonymous> (i.e. using it in a <Directory> context
is meaningless).
翻译:
最后,有一个用来限制登陆的特殊命令,就是LOGIN。在<limit>中用这个,可以禁止或者允许连接进来。但是,如果不在Server config,<VirtualHost>
或者<Anonymous>中使用的话,他将失去效用,或者说被忽略掉(比如在<Directory>中使用就是无效的)。
proftpd比vsftp功能配置上好用一点,掌握好<limit>段的配置即可。
附,proftpd文档地址 http://www.proftpd.org/docs/。