Installing ProFTPd with SuSE Linux 8.1

Version 7.3 of SuSE Linux included the ProFTPd within the compilation of software. However in version 8.1 of SuSE the ProFTPd daemon was not included. Since the ProFTPd was still required after the server was upgraded to SuSE 8.1, it was necessary to install it by hand. This brief article explains how it was done...
Content revision history:
Article first written, spring 2004

Introduction

In order to install ProFTPd on a SuSE GNU/Linux 8.1 system the following stages had to be completed.

  • obtain the ProFTP software.
  • Second, install the software on the computer.
  • Persuade the computer to automatically run the software at boot time.

These stages are described below:

Stage 1: Obtain a suitable RPM package

Version 1.2.8 of the software was acquired from the ProFTPd web site. Make sure that the version you obtain from the ProFTP web site is suitable for SuSE 8.1 or it might not install properly or, alternatively, might not work with the script provided later in this page.

Stage 2: Install the RPM

The software was acquired in RPM format and installed using the rpm utility. Since the software didn't previously exist on the computer the command was simply:

rpm --install <name_of_rpm_file>

If there had been a version already installed then a slightly different command would have been needed such as, for example:

rpm --freshen <name_of_rpm_file>

Stage 3: Create the necessary scripts

This is where things became more interesting. It was necessary to add the ProFTPd software into the list of things to be activated at boot. Since it is network software it was desirable to add the software into run-levels 3 and 5. This was accomplished as follows:

A small configuration file was created and added into the /etc/sysconfig directory, the contents of the file are shown elsewhere on this page. A script was acquired from a SuSE 7.3 installation. The complete script is shown lower on this page. Symbolic links were created to the script file and placed in the /etc/init.d/rc.3 and /etc/init.d/rc.5 directories. Two symbolic links were placed in each directory — one link to allow the daemon to be started and one link to allow it to be stopped.

Configuration file, newly created:

The provision of the following very simple configuration file allows the activation of the ProFTPd software to be controlled using the YaST system configuration tools. This file was called proftpd and therefore its full path name is “/etc/sysconfig/proftpd”.

#
# This file was created on 26th April, 2003.  It was NOT
# provided by any part of the original SuSE installation
# and therefore it might or might not work as expected.
#
# The file is intended to work in conjunction with the 
# proftpd script that is in the /etc/initd directory.
# That script will test the following variable.  If the
# ProFTP daemon is to be started automatically at
# system boot then the following variable should be set
# to "yes".
#
START_PROFTPD=yes
#

ProFTPd script acquired from SuSE 7.3 system:

The following script was placed in the /etc/init/d directory. The lines that were modified are highlighted; The script file was named “proftpd” so its full path and name are, therefore, “/etc/init.d/proftpd”.

#! /bin/sh
# Copyright (c) 2000-2001 SuSE GmbH Nuernberg, Germany.
# All rights reserved.
#
# Original author: Marius Tomaschewski <mt@suse.de>
#
# Slightly modified in 2003 for use with SuSE Linux 8.1, 
# by http://www.learnlinux.co.uk/
#
# /sbin/init.d/proftpd
#
### BEGIN INIT INFO
# Provides:		proftpd
# Required-Start:	$network $remote_fs $syslog $named
# Required-Stop:
# Default-Start:	3 5
# Default-Stop:	0 1 2 6
# Description:		Starts ProFTPD server
### END INIT INFO

# Source SuSE config
. /etc/sysconfig/proftpd     # This line modified by learnlinux.co.uk

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_PROFTPD=yes  # Modified by learnlinux.co.uk
test "$START_PROFTPD" = yes || exit 0    # Modified by learnlinux.co.uk

# Return values acc. to LSB for all commands but 
# status (see below):
#
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running

proftpd_cfg="/etc/proftpd.conf"
proftpd_bin="/usr/sbin/proftpd"
proftpd_pid="/var/run/proftpd.pid"

[ -r $proftpd_cfg ] || exit 6
[ -x $proftpd_bin ] || exit 5

# Source status functions
. /etc/rc.status

# First reset status of this service
rc_reset

case "$1" in
    start)
  echo -n "Starting ProFTPD Server: "
  test -f /etc/shutmsg && rm -f /etc/shutmsg
  /sbin/startproc $proftpd_bin
  rc_status -v
  ;;

    stop)
  echo -n "Shutting down ProFTPD Server: "
  test -x /usr/sbin/ftpshut && /usr/sbin/ftpshut now && sleep 1
  /sbin/killproc -TERM $proftpd_bin
  test -f /etc/shutmsg && rm -f /etc/shutmsg
  rc_status -v
  ;;

    restart)
  ## If first returns OK call the second, if first or
  ## second command fails, set echo return value.
  $0 stop
  $0 start
  rc_status
  ;;

    try-restart)
  ## Stop the service and if this succeeds (i.e. the
  ## service was running before), start it again.
  ## Note: not (yet) part of LSB (as of 0.7.5)
  $0 status >/dev/null &&  $0 restart
  rc_status
  ;;

    reload|force-reload)
  ## Exclusive possibility: Some services must be stopped
  ## and started to force a new load of the configuration.
  echo -n "Reload ProFTPD Server: "
  /sbin/killproc -HUP $proftpd_bin
  rc_status -v
  ;;

    status)
  # Status has a slightly different for the status command:
  # 0 - service running
  # 1 - service dead, but /var/run/  pid  file exists
  # 2 - service dead, but /var/lock/ lock file exists
  # 3 - service not running
  echo -n "Checking for ProFTPD Server: "
  checkproc $proftpd_bin
  rc_status -v
  ;;
	
    probe)
  ## Optional: Probe for the necessity of a reload,
  ## give out the argument which is required for a reload.
  [ $proftpd_cfg -nt $proftpd_pid ] && echo reload
  ;;

    *)
  echo "Usage: $0 {start|stop|status|restart|reload|try-restart|probe}"
  exit 1
  ;;
esac

# Set an exit status.
rc_exit

With these changes in place the ProFTPd daemon is started whenever the system is booted to runlevel 3 or 5. Furthermore the YaST configuration tools automatically recognize the new script and configuration file and include them in the appropriate displays. This means that the value of the control variable START_PROFTPD in “/etc/sysconfig/proftpd” can be changed from within the YaST environment and the file does not have to be edited directly.

Links:

 

Navigation: (site map) learn linux home pagetechnical articles