Portable FTP daemon project

Date: 2006-Sep-26
Name: Portable FTP daemon project (pftpd)
Current version: v0.1-beta
Status: Experimental
Programming language: Python
Author: billiejoex
License: GNU
Web: http://billiejoex.altervista.org

What is Portable FTP daemon project (pftpd)?

Pftpd is a proof of concept FTP daemon implementation entirely written in pure Python. It can work under normal user account and does not require any
special rights to start. Thanks to Python interpreter, the internal database password and the virtual path file-system abstraction it is extremely system undependant.

Currently supported FTP commands

USER / PASS user authentication
PASV / PORT active / passive FTP
list files and directories
PWD get current directory
CWD change current directory
CDUP go to parent directory
MKD create new directory
RMD remove directory
MKD create directory
DELE remove file
RNFR / RNTO rename file / directory
SIZE getting file size
SYST getting system type
TYPE setting transfer type (binary or ASCII)
NOOP do nothing
STOR upload file
RETR download file
ABOR stop transfer
QUIT disconnect



Win32 standalone executable:


The easiest thing you can do, if you are a Windows user, is using the precompiled binary stand alone distribution without installing Python iterpreter.
To run pftpd on all other systems you'll only need Python 2.5 interpreter installed.
You can get it from http://www.python.org. Pftpd claims to be the most portable as possible: for this reasons no third-party packages are required.


Unpack pftpd distribution into a directory, edit pftpd.conf depending on your needs and run pftpd.py from command line. That's all.
For further details about how to configure it and use advanced features take a look at "Installing pftpd on Linux" section treated later.


Pftpd uses multiple threads which means it manages the memory in quite an efficient way. Here are some tests I made by running pftpd on my AMD Athlon 2000+, 1Gb RAM, by using Python2.5:

Benchmark Type
Windows XP SP2
Linux Debian 2.4.x
about 34000 Kb/sec
 about 32000 Kb/sec
about 9200 Kb/sec
 about 10100 Kb/sec
Memory usage
2328 Kb
 2512 Kb



To do

  • FTP over SSL support.
  • Bandwidth throttling.
  • Windows system service support.
  • Support for resumed Upload / Downloads.
  • NAT/Firewall support with PASV (passive) mode connections.
  • PASV/PORT connection stealing protection.
  • IP-Based access control.
  • Encrypted database password caching.


This first beta release version has some known bugs not yet fixed and many features not yet implemented. It's a working FTP server implementation, supporting the main FTP commands, that has been tested with major FTP clients: MS Internet Explorer, Mozilla Firefox, Bullet proof FTP, Cute FTP, Konqueror, gftp and Windows & Linux command line FTP client.
As far as I can say... it works, but don't use it in production.



(fig. 1: Downloading a binary file on Windows by using Internet Explorer)

(fig. 2: Downloading a file with Linux command line ftp utility.)

Installing pftpd on Linux

  • Install Python 2.5. On debian:
apt-get install python2.5
  • Download and unpack a pftpd source distribution:
tar -xf [src]-pftpd_v0.1.tar
cd [src]-pftpd_v0.1.tar
  • Edit pftpd.conf depending on your needs. In the example below we create virtual user "James" and permit him to log.in. We also permit anonymous access.
vi pftpd.conf

## Portable FTP daemon (pftpd) configuration file

# Interface on which pftpd has to listen on (default == ALL).
# Specify an IP address if you want pftpd to listen on a single interface.

# Port on which ftpd has to bind on (default == 21).

# Here you can specify various types of messages to be sent during
# the client's session. You can use the followings:
# This message is sent after the client connected:
#msg_connect=Welcome to pftpd FTP server.

# This one after the client log-in.
#msg_login=Log-in succesful.

# This last one after that client decided to leave (QUIT command
# received).

# Log file location (default: current working directory + "ftpd.log").

# System logging. Here you can decide if you also want to write entries
# into the system log (on Linux system it's usually located in
# /var/log/syslog). It won't work for Windows systems (ignoring it).


# Debug file location (default: no debug on file).

### User list section ###

# Here you can add pftpd user entries. Every entry added here will be
# accepted by pftpd as a valid account.
# The one below is an example illustrating how to write a new user entry.
# Excepting anonymous user all permissions are granted by default so if
# you omit one of them pftpd will assume the default value (permit).


# Uncomment the entry below if you want to permit anonymous user to
# log in. Pay attention to policies! Pftpd permits a great freedom even
# about anonymous user's permissions.


  • Run:
python2.5 pftpd.py &