如何设定、编译与安装proftpd
如何设定、编译与安装proftpd
在安装proftpd之前,需要确定服务器上是否已经安装了编译器和相关的开发库。如果没有安装编译器和开发库,可以使用以下命令来安装:
yum install gcc gcc-c++ make openssl-devel
下载proftpd
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5a.tar.gz
解压缩
tar zxvf proftpd-1.3.5a.tar.gz
编译安装
cd proftpd-1.3.5a ./configure --prefix=/usr/local/proftpd make && make install
配置proftpd
修改配置文件
vi /usr/local/proftpd/etc/proftpd.conf
在文件中添加以下内容:
ServerName "proftpd" ServerType standalone DefaultServer on # Port 21 is the standard FTP port. Port 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 # Set the user and group under which the server will run. User nobody Group nobody # Normally, all root-owned files in /srv/ftp are inaccessible to non-root # users. Uncomment this to allow users to access these files.
启动proftpd
/usr/local/proftpd/sbin/proftpd
如果需要开机自动启动,可以将proftpd加入到系统服务中:
cp /usr/local/proftpd/contrib/dist/rpm/proftpd.init /etc/init.d/proftpd
修改proftpd的启动脚本
vi /etc/init.d/proftpd
在文件中添加以下内容:
#!/bin/sh # # proftpd This shell script takes care of starting and stopping # proftpd daemons. # # chkconfig: - 85 15 # description: ProFTPD is an enhanced FTP server with a strong focus toward \ # ease of configuration. It is free software, distributed \ # under the terms of the GNU General Public License. # processname: proftpd # pidfile: /var/run/proftpd.pid # config: /etc/proftpd.conf # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 prog="proftpd" # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 # Check that proftpd daemon is configured. [ -f /etc/proftpd.conf ] || exit 0 # See how we were called. case "$1" in start) echo -n $"Starting $prog: " daemon $prog -n RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog ;; stop) echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -f /var/lock/subsys/$prog ] && $0 restart ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL
使用以下命令来添加proftpd服务:
chkconfig --add proftpd
使用以下命令来启动proftpd服务:
service proftpd start
相关文章