2012年5月8日 | | 标签: , ,

鉴于Centos5.6上Proftpd比Vsftpd有更好的表现,于是果断卸载Vsftpd

yum remove vsftpd

因为Centos5.6上默认没有Proftpd的源,因此我们选择了编译安装:

cd /tmp/
wget –passive-ftp ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.3e.tar.gz
tar xvfz proftpd-1.3.3e.tar.gz
cd proftpd-1.3.3e/
./configure –sysconfdir=/etc
make
make install
cd ..
rm -fr proftpd-1.3.3e*

proftpd被安装在了 /usr/local/sbin, 但是我们需要它安装在 /usr/sbin,因此我们建立一个符号链接:

ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd

现在我们新建 /etc/init.d/proftpd:

vi /etc/init.d/proftpd

#!/bin/sh
# $Id: proftpd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
#
# proftpd        This shell script takes care of starting and stopping
#                proftpd.
#
# chkconfig: - 80 30
# description: ProFTPD is an enhanced FTP server with a focus towards \
#              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/proftp.conf
# pidfile: /var/run/proftpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/proftpd ] || exit 0

RETVAL=0

prog="proftpd"

start() {
        echo -n $"Starting $prog: "
        daemon proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
}

stop() {
        echo -n $"Shutting down $prog: "
        killproc proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status proftpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f /var/lock/subsys/proftpd ]; then
          stop
          start
        fi
        ;;
  reload)
        echo -n $"Re-reading $prog configuration: "
        killproc proftpd -HUP
        RETVAL=$?
        echo
        ;;
  *)
        echo "Usage: $prog {start|stop|restart|reload|condrestart|status}"
        exit 1
esac

exit $RETVAL

然后我们使它可执行:

chmod 755 /etc/init.d/proftpd

接着我们打开 /etc/proftpd.conf 修改其中的 Group 为 nobody:

vi /etc/proftpd.conf

[...]
Group                           nobody
[...]

出于安全考虑您也可以加入以下到 /etc/proftpd.conf (更多详情请访问: :

vi /etc/proftpd.conf

[...]
DefaultRoot ~
IdentLookups off
ServerIdent on "FTP Server ready."
[...]

为了使ftp用户能使用 chmod 命令, 请注释掉 <Limit SITE_CHMOD> 部分:

[...]
# Bar use of SITE CHMOD by default
#<Limit SITE_CHMOD>
#  DenyAll
#</Limit>
[...]

现在我们让Proftpd随系统自启动:

chkconfig –levels 235 proftpd on

最后我们启动Proftpd:

/etc/init.d/proftpd start

搞定收工