mTCP FTP Server for DOS logo

mTCP FTPSrv is an open source FTP server for DOS that is designed to run well on just about any machine that runs DOS. That includes everything from a PCjr running DOS 3.3 to the latest virtual machines running whatever version of DOS you have installed. Features include:

The very detailed readme file for the FTP server can be found here: ftpsrv.txt

Here is a screen shot of the FTP server running under DOSBox:

mTCP FTP server screen shot

mTCP FTPSrv startup and a connected user

Why would anybody want to use an FTP server?



The complete instructions for setting up and using the FTP server are probably a little too long for a single web page. The complete guide can be found in the ftpsrv.txt file that comes with mTCP. What follows is a brief overview.

The FTP server requires some setup before you can use it. Assuming that your network card is setup getting the basic FTP server setup done should take no more than five or ten minutes. A more complicated setup that allows for anonymous FTP, accounts for specific users, and sandbox areas will take longer. Setting up the FTP server for use behind a firewall takes a little more effort and the documentation will guide you through it including explaining the basic concepts.

There are only two required configuration parameters needed to run the FTP server. They need to be placed in the mTCP configuration file. Optional parameters can be used for complex networking setups and performance tuning. The configuration parameters are:

Required settings
FTPSRV_PASSWORD_FILE <path_and_filename>      A full path to your password file for the FTP server
FTPSRV_LOG_FILE <path_and_filename>      A full path to file used to log FTP server activity
Optional settings
FTPSRV_SESSION_TIMEOUT <seconds>      A session timeout for users
FTPSRV_CONTROL_PORT <port number>      The port to listen on for incoming connections
FTPSRV_EXT_IPADDR <numerical ip address>      Firewall support: what IP address to report to clients for making new connections
FTPSRV_PASV_BASE <port number>      Firewall support: start of the range of data ports to use
FTPSRV_PASV_PORTS <number of ports to use>      Firewall support: block of data ports to use
FTPSRV_CLIENTS <number of clients>      How many clients to support at the same time
FTPSRV_MOTD_FILE <path_and_filename>      Message of the day file
FTPSRV_FILEBUFFER_SIZE <n>      Performance: How much RAM to use for buffering file reads and writes
FTPSRV_TCPBUFFER_SIZE <n>      Performance: How much RAM to use for TCP/IP buffering
FTPSRV_PACKETS_PER_POLL <n>      Performance: How many packets to process from the wire at a time
FTPSRV_EXCLUDE_DRIVES <drive_letters>      Which drive letters should be hidden from connected users

The mTCP configuration file is described here: mTCP_Configuration.html

The FTP server uses a password file to determine who is allowed to connect to the FTP server and what they are allowed to do. Each line in the password file defines a user and what that user is allowed to do. Here is the format of the line:

userid password sandbox_directory incoming_directory permissions

And here is a quick description of the fields:

userid      This can be up to 10 characters in length
password      This can be up to 10 characters in length and can include most characters except spaces. If you want to setup anonymous FTP this field will contain "[email]"
sandbox_directory      This allows you to restrict a user to a specific subdirectory of your filesystem
incoming_directory      If the user is allowed to upload you can restrict the user to putting uploads in a specific directory.
permissions      Allows you to set which FTP operations are allowed for this user. This includes uploading files, deleting files, making directories, etc.

This is a sample password file that demonstrates a named user with no restrictions, a named user with restrictions on uploading, an anonymous account with uploading, and a readonly user with no uploading:

brutman    passw0rd  [none]        [any]                  all
tester b0guspw [none] /drive_e/ftp/incoming stor stou
anonymous [email] /drive_e/ftp /incoming stor stou
readonly [email] /drive_e/ftp [any]

The first user has no restrictions on directories and permission to use all of the filesystem altering commands. The second user can see the entire system but is restricted to only uploading in one directory, and they can only put files - they can't delete, create or remove directories, or append to existing files. The third user is restricted to one directory and its subdirectories (a sandbox) and may only upload to one directory within that sandbox. The last user can only look in one directory and its subdirectories (a sandbox) and may not upload. (Ignore the [any] field, it's just holding a place.)

Please read the detailed documentation before setting up an FTP server that will be used for anonymous FTP. Security is always a real concern and it is possible to misconfigure your web server if you don't follow the directions and test your permissions.

Running the FTP server after configuration is complete is easy - Just enter the ftpsrv command. When the FTP server starts up it will read and error check its configuration file. It will then read and error check the users file. If all goes well you will see a console like the one pictured above.


FTPSrv is included with the other mTCP applications. They can be downloaded from the main mTCP page here.

Aside from the FTPSRV.EXE program and a packet driver to talk to your Ethernet card, no other downloads are needed. Everything that FTPSrv needs to connect on the Internet is included in the program.

Miscellaneous notes

The FTP server is a DOS program and it is subject to the the rules of DOS paths and filenames. A path to a file can not be longer than 63 characters. A filename follows the 8.3 format. There is no long filename support. The FTP server enforces these restrictions to prevent crashes due to buffer overflows.

DOS uses drive letters and the backslash character as a directory delimiter. Both of these confuse most FTP clients. To keep compatibility with the largest number of FTP clients the FTP server does not show DOS style drive letters and paths to connected users. It rewrites the drive letter part to look like /drive_X/ where X is the drive letter and the path delimeters use forward slashes, not backslashes. The FTP server also presents the image of a root file directory '/' where the subdirectories are the available drive letters. Clients will be told it is a Unix-like server and will see Unix-like behavior from it.

The FTP server console will use whatever screen mode that DOS is using at the time you start it. If you have an EGA display or better you can setup your screen mode to display more rows and columns. EGA users can use 80x43, VGA users can go up to 80x50, and SVGA users may be able to use 132x50. The screen modes available to you depend on your video card.

This version of FTPSrv is open source software licensed under the GPL, version 3. Share and enjoy.

FTP server "SITE" commands

A "SITE" command is a non-standard FTP command that a client can send to a server to do things that are not part of the official FTP specification. The mTCP FTP server includes four SITE commands for your amusement:

DISKFREE <X>      Show free disk space for drive letter X
HELP      Give help for the SITE command
STATS      Respond with some fun statistics
WHO      Show who is online

Most FTP clients have a way to send a SITE command. It would not be difficult to add more if there was a need.


Nothing is perfect but we can try ...

The FTP server is part of the mTCP project which features a TCP/IP library for DOS and several TCP/IP applications that use the library. The applications include a DHCP client, a Telnet client, an IRC client, an FTP client, Ping, Netcat, an SNTP client, and an HTTP file fetcher. All of the software is open source and is licensed under the GPL, version 3. More information about mTCP can be found at the mTCP project page.

Have a comment or need help? Please email me at mbbrutman at

Recent Changes

Link: mTCP main project page

Created January 2nd, 2011, Last updated December 23nd, 2013
(C)opyright Michael B. Brutman, mbbrutman at