Author Topic: How to compile proftpd on debian (ubuntu)  (Read 16544 times)

Offline Fermulator

  • New user
  • *
  • Posts: 4
    • View Profile
How to compile proftpd on debian (ubuntu)
« on: August 23, 2006, 04:01:55 pm »
Hello!

I'm hoping someone can help me with this.

In ubuntu, normally, one could install proftpd using
Code: [Select]
sudo apt-get install proftpd
Done.  Very simple.

However, I require the mod_shaper module from castaglia, so I need to compile manually.

Here are the steps I've taken:
Download the proftpd source files proftpd-1.3.0.tar.gz.
Untar using
Code: [Select]
tar zxvf proftpd-1.3.0.tar.gz

Download the mod_shaper

As per mod_shaper instructions, copy the mod_shaper.c file into the /contrib directory in the proftpd source files.

To compile: (as root)
Code: [Select]
./configure --enable-ctrls --with-modules=mod_shaper
make
make install


Yay!
We can manually start the server using:
Code: [Select]
/usr/local/sbin/proftpd -c /etc/proftpd.conf

So I'm pretty close with finishing this...
The only thing it's missing is the proper '/etc/init.d/proftpd' file.
(Which would normally be used to start/stop/reload the proftpd daemon)
i.e. :
Code: [Select]
/etc/init.d/proftpd start
or
Code: [Select]
/etc/init.d/proftpd reload

Could anyone please help me to either
[list=1]
  • show me the proper /etc/init.d/proftpd file...
  • help me modify this file based on the "apt-get install proftpd" package...(See below for it's contents)
  • [/list:o]

    You're time is greatly appreciated.

Sources:
http://www.linuxhelp.net/guides/proftpd/
http://www.castaglia.org/proftpd/modules/mod_shaper.html#Installation


Sample /etc/init.d/proftpd file:

NOTE:  Someone has done it already for SuSe, but this doesn't work for debian (ubuntu).
http://www.howtoforge.com/book/print/150

apt-get install proftpd /etc/init.d/proftp file sample:
Quote
#!/bin/sh

# Start the proftpd FTP daemon.

PATH=/bin:/usr/bin:/sbin:/usr/local/sbin

# Defaults
RUN="no"
OPTIONS=""
CONF=/etc/proftpd.conf

test -f $DAEMON || exit 0

# Read config (will override defaults)
[ -r /etc/default/proftpd ] && . /etc/default/proftpd

if [ ! -r $CONF ]; then
   echo "Missing configuration file $CONF"
   exit 0
fi

NAME=proftpd
DAEMON=/usr/local/sbin/$NAME

PIDFILE=$(grep -i 'pidfile' $CONF | sed -e 's/pidfile[\t ]\+//i')
if [ "x$PIDFILE" = "x" ];
then
   PIDFILE=/var/run/$NAME.pid
fi

trap "" 1
trap "" 15


#
# Test if configuration file provided is ok
#
$DAEMON -t -c $CONF >/dev/null 2>&1
if [ $? -ne 0 ]; then
   ISOK="$NAME"$($DAEMON -t 2>&1|grep ' - ')
else
   ISOK="yes"
fi

#
# Servertype could be inetd|standalone|none.
# In all cases check against inetd and xinetd support.
#
ENABLED=$RUN
if ! egrep -qi "^[[:space:]]*ServerType.*standalone" $CONF
then
    if [ $(dpkg-divert --list xinetd|wc -l) -eq 1 ]
    then
   if egrep -qi "server[[:space:]]*=[[:space:]]*$DAEMON" /etc/xinetd.conf 2>/dev/null || \
      egrep -qi "server[[:space:]]*=[[:space:]]*$DAEMON" /etc/xinetd.d/* 2>/dev/null
   then
          RUN="no"
          INETD="yes"
   else
      if ! egrep -qi "^[[:space:]]*ServerType.*inetd" $CONF
      then
             RUN="yes"
         INETD="no"
      else
         RUN="no"
         INETD="no"
      fi
   fi
    else
       if egrep -qi "^ftp.*$NAME" /etc/inetd.conf 2>/dev/null
       then
          RUN="no"
          INETD="yes"
       else
      if ! egrep -qi "^[[:space:]]*ServerType.*inetd" $CONF
      then
             RUN="yes"
         INETD="no"
      else
         RUN="no"
         INETD="no"
      fi
       fi
    fi
fi

# /var/run could be on a tmpfs
[ ! -d /var/run/proftpd ] && mkdir /var/run/proftpd

start()
{
    if [ "$ISOK" != "yes" ]; then
   echo "$ISOK"
    else
        if start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON -- $OPTIONS -c $CONF; then
           echo "$NAME"
        else
           echo "failed"
        fi
    fi
}

signal()
{
    if [ "$1" = "stop" ]; then
   SIGNAL="TERM"
    else
   if [ "$1" = "reload" ]; then
       SIGNAL="HUP"
   else
       echo "ERR: wrong parameter given to signal()"
   fi
    fi
    if start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"; then
        echo "$NAME"
    else
   SIGNAL="KILL"
   if start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"; then
      echo "$NAME"
   else
           echo "failed"
   fi
    fi
    if [ "$SIGNAL" = "KILL" ]; then
       rm -f "$PIDFILE"
    fi
}

case "$1" in
    start)
   if [ "x$RUN" = "xyes" ] ; then
       echo -n "Starting ProFTPD ftp daemon: "
       start
   else
       if [ "x$INETD" = "xyes" ] ; then
      echo "ProFTPd is started from inetd/xinetd."
       else
           if [ "x$ENABLED" = "xyes" ]; then
            echo "ProFTPd warning: not start neither in standalone nor in inetd/xinetd mode, apparently. Check your configuration."
      else
            echo "ProFTPd disabled by admin. See /etc/default/proftpd."
      fi
       fi
   fi
   ;;

    force-start)
   if [ "x$INETD" = "xyes" ] ; then
       echo "Warning: ProFTPd is started from inetd/xinetd (trying to start anyway)."
   fi
   echo -n "Starting ProFTPD ftp daemon: "
   start
   ;;   
   
    stop)
   if [ "x$RUN" = "xyes" ] ; then
       echo -n "Stopping ProFTPD ftp daemon: "
       signal stop
   else
       if [ "x$INETD" = "xyes" ] ; then
      echo "ProFTPd is started from inetd/xinetd."
       else
           if [ "x$ENABLED" = "xyes" ]; then
            echo "ProFTPd warning: not started neither in standalone nor in inetd/xinetd mode, apparently. Check your configuration."
      else
            echo "ProFTPd disabled by admin. See /etc/default/proftpd."
      fi
       fi
   fi
   ;;

    force-stop)
   if [ "x$INETD" = "xyes" ] ; then
       echo "Warning: ProFTPd is started from inetd/xinetd (trying to kill anyway)."
   fi
   echo -n "Stopping ProFTPD ftp daemon: "
   signal stop
   ;;

    reload)
   if [ "$ISOK" != "yes" ]; then
      echo "$ISOK"
   else
      echo -n "Reloading $NAME configuration..."
      signal reload
      echo " done."
       fi
   ;;

    force-reload|restart)
   if [ "x$RUN" = "xyes" ] ; then
       if [ "$ISOK" != "yes" ]; then
           echo "$ISOK"
       else
         echo -n "Restarting ProFTPD ftp daemon."
         signal stop
         echo -n "."
          sleep 2
          echo -n "."
          start
          echo " done"
       fi
   else
       if [ "x$INETD" = "xyes" ] ; then
      echo "ProFTPd is started from inetd."
       else
           if [ "x$ENABLED" = "xyes" ]; then
            echo "ProFTPd warning: not started neithr in standalone nor in inetd/xinetd mode, apparently. Check your configuration."
      else
            echo "ProFTPd disabled by admin. See /etc/default/proftpd."
      fi
       fi
   fi
   ;;

    *)
   echo "Usage: /etc/init.d/$NAME {start|force-start|stop|force-stop|reload|restart|force-reload}"
   exit 1
   ;;
esac

exit 0
Fermmy

Offline Flo

  • Supporter
  • ***
  • Posts: 100
    • View Profile
Re: How to compile proftpd on debian (ubuntu)
« Reply #1 on: November 20, 2016, 12:26:02 pm »
I have the same problem. Have you found a solution yet ?

Offline Fermulator

  • New user
  • *
  • Posts: 4
    • View Profile
Re: How to compile proftpd on debian (ubuntu)
« Reply #2 on: December 11, 2016, 02:00:43 am »
wow super old ;/ - definitely no longer hosting an FTP server... sorry I cannot recall if I ever got it working, or I just bailed on it. (usually I would go back and update the forum post if I had figured it out ... so chances are that I just bailed on this)
Fermmy

Offline Fermulator

  • New user
  • *
  • Posts: 4
    • View Profile
Re: How to compile proftpd on debian (ubuntu)
« Reply #3 on: December 11, 2016, 02:01:29 am »
also ... should go with systemd at this point anyway (rather than init.d)
Fermmy

Offline mavirroco

  • New user
  • *
  • Posts: 1
    • View Profile
Re: How to compile proftpd on debian (ubuntu)
« Reply #4 on: December 20, 2016, 09:12:28 pm »
i wanted install proftpd 1.3.5b on ubuntu 14 but not want to start i guess my /etc/init.d/proftpd is bad
there is some that have a good file


thanks in advance

Offline Flo

  • Supporter
  • ***
  • Posts: 100
    • View Profile
Re: How to compile proftpd on debian (ubuntu)
« Reply #5 on: February 24, 2017, 09:13:00 pm »
I finally found out how to compile modules with proftpd and get a init.d file etc.

 

sighted planning