Archiv der Kategorie: FTP

PureFTP Init Script

#!/bin/bash

PATH=’/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin’
FTP=”$(which pure-ftpd)”

###########################################################################################
#START=”/etc/pureftp/pure-config.pl /etc/pureftp/pure-ftpd.conf”                                                                                                                  #
# Die Zeile über mir erzeugt Fehlermeldungen von Perl welche sich nicht unterdrücken lassen. Deswegen unter mir der Aufrufstring den das Perl #
#Script erzeugt.                                                                                                                                                                                          #
###########################################################################################
START=”/usr/local/sbin/pure-ftpd 1 -A -c50 -B -C8 -d -D -E -fftp -H -I15 -lmysql:/etc/pureftp/pureftpd-mysql.conf -L10000:8 -m4 -s -U133:022  -u100 -j -k99 -Z”

NAME=’pure-ftpd’
PID=”$(pidof $FTP)”

test -x $FTP || exit 0

set -e
case “$1” in
start)
echo -n “Starting $NAME”
echo
$START 1&2> /dev/null
;;
stop)
echo -n “Stopping $NAME ”
echo
kill -9 $PID 1&2> /dev/null
;;
status)
[ -z $PID ]  || echo “$NAME  is running with PID $PID ”
[ -z $PID ]  && echo “$NAME is not running”
;;
restart|force-reload)
bash $0 stop
sleep 1
bash $0 start
;;
*)
N=/etc/init.d/$NAME
echo “Usage: $N {start|stop|restart|force-reload}” >&2
exit 1
;;
esac
exit 0

Using Proftpd with Active Directory

Snippets from proftpd.conf

<IfModule mod_auth_pam.c>
AuthPAM off
</IfModule>

<IfModule mod_ldap.c>
LoadModule mod_ldap.c
AuthOrder mod_ldap.c
LDAPServer ldap://192.168.0.1  # your server IP
LDAPAttr uid sAMAccountName
LDAPattr gidNumber primaryGroupID
LDAPDNInfo “CN=adminuser,cn=Users,DC=domain,DC=com ” “somepassword”
LDAPAuthBinds on
LDAPDoAuth on “CN=Users,DC=domain,DC=com” (&(sAMAccountName=%v)(objectclass=*))
</IfModule>

RequireValidShell off
UseFtpUsers off
PersistentPasswd off

start Proftpd in debug mode:

proftpd -nd10

connect to ftp using the Active Directory Credentials shows in the log:

ldapserver (testmachine) – mod_ldap/2.8.17: connected to 192.168.0.1:389
ldapserver (testmachine) – mod_ldap/2.8.17: set protocol version to 3
ldapserver (testmachine) – mod_ldap/2.8.17: successfully bound as CN=adminuser,cn=Users,DC=domain,DC=com  with password somepassword
ldapserver (testmachine) – mod_ldap/2.8.17: set dereferencing to 0
ldapserver (testmachine) – mod_ldap/2.8.17: set query timeout to 0s
ldapserver (testmachine) – mod_ldap/2.8.17: generated filter (sAMAccountName=testuser) from template (sAMAccountName=%u) and value testuser
ldapserver (testmachine) – mod_ldap/2.8.17: searched using filter (sAMAccountName=testuser)
ldapserver (testmachine) – mod_ldap/2.8.17: no entries for filter (sAMAccountName=testuser)
ldapserver (testmachine) – no such user ‘testuser’

weiterlesen …