Pejman Moghadam / Slackware

Slackware 13.1 - Installing Pure-FTPd (with epkg)

Public domain


Installation

cd /usr/src
wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/pure-ftpd-1.0.29.tar.bz2"
su - install 
cd /usr/src
tar xf pure-ftpd-1.0.29.tar.bz2
cd pure-ftpd-1.0.29
./configure                        \
  --prefix=/usr                    \
  --with-altlog                    \
  --with-puredb                    \
  --with-extauth                   \
  --with-cookie                    \
  --with-throttling                \
  --with-ftpwho                    \
  --with-ratios                    \
  --with-quotas                    \
  --with-uploadscript              \
  --with-virtualhosts              \
  --with-diraliases                \
  --with-peruserlimits             \
  --with-rfc2640                   \
  --with-language=english
make && make install-strip DESTDIR=/usr/local/encap/pure-ftpd-1.0.29
cd /usr/local/encap/pure-ftpd-1.0.29/
mv usr/share/man usr/
cd /usr/local/encap
mkencap pure-ftpd-1.0.29/
logout
cd /usr/local/encap
epkg pure-ftpd-1.0.29

Add main ftp user

groupadd ftpgroup
useradd -g ftpgroup -d /dev/null -s /etc ftpuser

Add virtual ftp user (/etc/pureftpd.passwd)

pure-pw useradd pejman -u ftpuser -d /home/ftpusers/pejman -r 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,127.0.0.1/32

-r  <allow client ip>/<mask>
-R  <deny  client ip>/<mask>

Change virtual ftp user (/etc/pureftpd.passwd)

pure-pw passwd pejman
pure-pw usermod pejman -n 1000 -N 10

-n <max number of files>
-N <max Mbytes>

Check virtual ftp user status (/etc/pureftpd.passwd)

pure-pw show pejman

Delete virtual ftp user status (/etc/pureftpd.passwd)

pure-pw userdel pejman

Apply virtual ftp users change (updates /etc/pureftpd.pdb)

pure-pw mkdb

/etc/issue

 __    _                _____                     
|  |  |_|___ _ _ _ _   |   __|___ ___ _ _ ___ ___ 
|  |__| |   | | |_'_|  |__   | -_|  _| | | -_|  _|
|_____|_|_|_|___|_,_|  |_____|___|_|  \_/|___|_|

/etc/issue

----==--
---==---(_)__  __ ____  __
--==---/ / _ \/ // /\ \/ /
-=====/_/_//_/\_,_/ /_/\_\

/etc/rc.d/rc.pure-ftpd

#!/bin/bash
#
# Startup Script
#

DAEMON="pure-ftpd"
PID_FILE="/var/run/pure-ftpd.pid"
START="/usr/sbin/pure-ftpd"
STOP="kill -TERM $(cat ${PID_FILE})"
TIMEOUT="5"
PARAM="  --logpid                             \
         --ipv4only                           \
         --chrooteveryone                     \
         --daemonize                          \
         --maxclientsnumber 50                \
         --maxclientsperip  5                 \
         --noanonymous                        \
         --fortunesfile /etc/issue            \
         --pidfile /var/run/pure-ftpd.pid     \
         --dontresolve                        \
         --anonymouscantupload                \
         --maxidletime 3                      \
         --maxdiskusagepct 95                 \
         --altlog stats:/var/log/pureftpd.log \
         --nochmod                            \
         --antiwarez                          \
         --userbandwidth 10                   \
         --minuid 1000                        \
         --umask 077:077                      \
         --peruserlimits 3:0                  \
         --customerproof                      \
         --createhome                         \
         --login puredb:/etc/pureftpd.pdb     \
         --userbandwidth 5120:5120
"

start()
{
  echo "Starting ${DAEMON} : ${START} "
  PROCESS=$(ps -A | egrep " ${DAEMON}$")
  if [ "${PROCESS}" == "" ]; then
    if [ -f "${PID_FILE}" ] ; then
      rm "${PID_FILE}"
    fi
    ${START} ${PARAM}
    ps -A | egrep " ${DAEMON}$"
    echo
  fi
}

stop()
{
  echo -n "Stopping ${DAEMON} "
  ${STOP}
  sleep 1
  for I in $(seq 1 $TIMEOUT); do
    PROCESS=$(ps -A | egrep " ${DAEMON}$")
    if [ "${PROCESS}" == "" ]; then
      break
    else
      echo -n "${I} "
    fi
    sleep 1
  done
  echo
  ps -A | egrep " ${DAEMON}$"
}

case "$1" in
  'start')
    start
    ;;
  'stop')
    stop
    ;;
  'restart')
    stop
    sleep 1
    start
    ;;
  *)
    echo "usage $0 start|stop|restart"
    ;;
esac

/etc/rc.d/rc.local

# Start Pure-FTPd Server :
if [ -x /etc/rc.d/rc.pure-ftpd ]; then
  /etc/rc.d/rc.pure-ftpd start
fi

/etc/rc.d/rc.local_shutdown

#!/bin/bash
# Stop Pure-FTPd server:
if [ -x /etc/rc.d/rc.pure-ftpd ]; then
  /etc/rc.d/rc.pure-ftpd stop
fi

Commands

chmod +x /etc/rc.d/rc.pure-ftpd
chmod +x /etc/rc.d/rc.local_shutdown
/etc/rc.d/rc.pure-ftpd start

BY: Pejman Moghadam
TAG: epkg, ftp, pureftp
DATE: 2011-07-28 23:41:53


Pejman Moghadam / Slackware [ TXT ]