Online Book Reader

Home Category

Running Linux, 5th Edition - Matthias Kalle Dalheimer [445]

By Root 1057 0
be tailored for Red Hat, so if you use SUSE, you need to do a few adjustments. The rc script installs to /etc/rc.d/init.d/proftpd, which isn't the right location on SUSE; also, the script itself will not work. Instead, use the following replacement script and copy it to /etc/rc.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

PROFTPD=/usr/sbin/proftpd

PATH="$PATH:/usr/sbin"

if [ -f /etc/sysconfig/proftpd ]; then

. /etc/sysconfig/proftpd

fi

. /etc/rc.status

rc_reset

# See how we were called.

case "$1" in

start)

echo -n "Starting proftpd: "

startproc $PROFTPD $OPTIONS

rc_status -v

;;

stop)

echo -n "Shutting down proftpd: "

killproc -TERM $PROFTPD

rc_status -v

;;

try-restart)

$0 status

if test $? = 0; then

$0 restart

else

rc_reset # Not running is not a failure.

fi

# Remember status and be quiet

rc_status

;;

status)

checkproc $PROFTPD

rc_status -v

;;

restart)

$0 stop

$0 start

rc_status

;;

reload)

echo -n "Re-reading proftpd config: "

killproc -HUP $PROFTPD

rc_status -v

;;

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|try-restart|status|reload|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

rc_exit

Of course, this could be fixed in a later version.

Compiling from Source

Download the tarball, unpack, configure, and build:

$ tar xfj proftpd-1.2.10.tar.bz2

$ cd proftpd-1.2.10

$ ./configure --prefix=/usr/local/packages/proftpd

$ make

Then, as root, run make install. This will install everything to /usr/local/ packages/proftpd/.

Running ProFTPD

Starting the server

When the rc script is in place, the server can be started with /etc/rc.d/proftpd start (/etc/init.d/proftpdstart on Debian).

Stopping the server

To shut the FTP daemon down, run /etc/rc.d/proftpd stop.

Temporarily suspending the server

With /etc/rc.d/proftpd suspend you can stop ProFTPD from accepting new connections. Users who try to log in will be greeted with a banner telling them that the server is down for maintenance. To resume normal operations, run /etc/rc.d/proftpd resume.

Debugging

While troubleshooting or writing the ProFTPD configuration file, it is often useful to get some extra information about what is going on. proftpd -vv will print out some version information, proftpd --nodaemon will run the daemon without becoming a background process, and proftpd -t will check the syntax of the current configuration file. Output verbosity can be increased by running ProFTPD like this: proftpd -d9. The options -d0 to -d9 can be combined with the other options.

Configuration

Getting Started

Both the RPM and tarball installations provide a default configuration with a readonly anonymous FTP area and full regular access to users on the system. This is a good starting point if all you want is to offer anonymous FTP access.

The configuration file for ProFTPD is /etc/proftpd.conf or $prefix/etc/proftpd.conf if installed from source. The anonymous FTP users are chroot()ed into the home directory of the FTP user, often something like /srv/ftp/.

proftpd.conf contains a number of configuration directives. A reference

Return Main Page Previous Page Next Page

®Online Book Reader