Ubuntu & Debian Linux - Installation Pure-FTP

Aus Laub-Home Wiki

Hier eine kleine Anleitung wie man einen FTP Server (pure-ftpd) mit TLS Verschlüsselung installiert und konfiguriert.

Installation

aptitude update
aptitude install pure-ftpd-common

Konfiguration

Zuerst erstellen wir den Systembenutzer mit dessen Rechten die virtuellen FTP Benutzer arbeiten:

useradd -d /dev/null -s /bin/false ftpuser

als nächstes erstellen wir ein SSL Zertifikat für die TLS Verschlüsselung:

openssl req -x509 -days 10000 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

Jetzt den pure-ftpd Server konfigurieren, die Konfigurationsoptionen werden einfach als Datei angelegt und der Inhalt dieser Dateien sind die Konfigurationsparameter.
/etc/pure-ftpd/conf/

ls -l /etc/pure-ftpd/conf/
-rw------- 1 root root  3 Jan  9  2009 AllowAnonymousFXP
-rw------- 1 root root  4 Sep 14  2007 AllowUserFXP
-rw------- 1 root root 34 Jun 28  2009 AltLog
-rw------- 1 root root  3 Sep 14  2007 AnonymousCanCreateDirs
-rw------- 1 root root  4 Jan  9  2009 AnonymousCantUpload
-rw------- 1 root root  3 Sep 14  2007 AnonymousOnly
-rw------- 1 root root  3 Jan  6  2009 AntiWarez
-rw------- 1 root root  3 Sep 14  2007 AutoRename
-rw------- 1 root root 14 May 25 14:55 Bind
-rw------- 1 root root  4 Sep 14  2007 BrokenClientsCompatibility
-rw------- 1 root root  3 Jan  8  2009 ChrootEveryone
-rw------- 1 root root  4 Sep 14  2007 CreateHomeDir
-rw------- 1 root root  4 Jan  9  2009 CustomerProof
-rw------- 1 root root  4 Sep 14  2007 Daemonize
-rw------- 1 root root  4 Sep 14  2007 DisplayDotFiles
-rw------- 1 root root  4 Sep 14  2007 DontResolve
-rw------- 1 root root 18 Jan  6  2009 ForcePassiveIP
-rw------- 1 root root 25 Feb  3 13:17 FortunesFile
-rw-r--r-- 1 root root  6 Dec 15 12:02 FSCharset
-rw-r--r-- 1 root root  4 Jan  9  2009 IPV4Only
-rw------- 1 root root  4 Sep 30  2008 KeepAllFiles
-rw------- 1 root root  8 Sep 14  2007 LimitRecursion
-rw------- 1 root root  3 Jan  9  2009 MaxClientsNumber
-rw------- 1 root root  2 Mar 31  2009 MaxClientsPerIP
-rw------- 1 root root  3 Nov 29  2007 MaxDiskUsage
-rw------- 1 root root  2 Jul  7  2009 MaxIdleTime
-rw------- 1 root root  2 Sep 14  2007 MaxLoad
-rw------- 1 root root  5 Sep 14  2007 MinUID
-rw-r--r-- 1 root root  3 Jan  9  2009 NATmode
-rw------- 1 root root  4 Sep 14  2007 NoAnonymous
-rw------- 1 root root  4 Sep 14  2007 NoChmod
-rw------- 1 root root  3 Jan  7  2009 PAMAuthentication
-rw------- 1 root root 12 Jan  6  2009 PassivePortRange
-rw------- 1 root root  3 Sep 14  2007 ProhibitDotFilesRead
-rw------- 1 root root  3 Sep 14  2007 ProhibitDotFilesWrite
-rw------- 1 root root 28 Sep 14  2007 PureDB
-rw------- 1 root root  4 Jun 28  2009 SyslogFacility
-rw------- 1 root root  2 Dec 13  2007 TLS
-rw------- 1 root root  8 Sep 14  2007 Umask
-rw------- 1 root root  3 Sep 14  2007 UnixAuthentication
-rw------- 1 root root  3 Sep 14  2007 VerboseLog
==> AllowAnonymousFXP <==
no

==> AllowUserFXP <==
yes

==> AltLog <==
stats:/var/log/pure-ftpd/pure-ftpd.log

==> AnonymousCanCreateDirs <==
no

==> AnonymousCantUpload <==
yes

==> AnonymousOnly <==
no

==> Bind <==
0.0.0.0,21

==> BrokenClientsCompatibility <==
yes

==> ChrootEveryone <==
yes

==> CreateHomeDir <==
yes

==> CustomerProof <==
yes

==> Daemonize <==
yes

==> DisplayDotFiles <==
yes

==> DontResolve <==
yes

==> FSCharset <==
UTF-8

==> IPV4Only <==
yes

==> MaxDiskUsage <==
20

==> MaxLoad <==
4

==> MinUID <==
1000

==> NoAnonymous <==
yes

==> PAMAuthentication <==
no

==> ProhibitDotFilesRead <==
no

==> ProhibitDotFilesWrite <==
no

==> PureDB <==
/etc/pure-ftpd/pureftpd.pdb

==> SyslogFacility <==
ftp

==> TLS <==
2

==> Umask <==
553 002

==> UnixAuthentication <==
no

==> VerboseLog <==
no

Da wir als Authentifizierung die PureDB nutzen wollen muss noch ein symbolischer Link gesetzt werden:

cd /etc/pure-ftpd/auth
ln -s ../conf/PureDB 50pure

Nun noch einen User anlegen und die Userdatenbank schreiben:

pure-pw useradd ftpbenutzer -u ftpuser -d /srv/pure-ftpd/ftpbenutzer
pure-pw mkdb

zu guter Letzt starten wir den FTP Server neu:

/etc/init.d/pure-ftpd restart

nun sollte die folgende Abfrage folgende Ausgabe haben:

ps ax | grep pure-ftpd

1238 ?        Ss     0:01 pure-ftpd (SERVER) 

Nun kann man die Verbindung mittels FTP Client testen.
Folgende Clients können zum Beispiel mit TLS Verschlüsselte FTP Verbindungen:

  • Filezilla
  • FireFTP (Plugin für den Firefox)
  • FlashFXP