Skip to content

bruceg/twoftpd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twoftpd
Simple secure efficient FTP server
Bruce Guenter <[email protected]>
Version @VERSION@
@TODAY@

This is twoftpd, an FTP server that strives to be secure, simple, and
efficient.  None of the back end commands can cause execution of other
programs, and the normal model of execution does a chroot to the logged
in user's directory immediately after authentication.

The name "twoftpd" comes from the fact that there were two parts to the
server -- an authenticating front end, which contains no file or data
transfer code, and a back end, which contains all the data transfer
code.

A mailing list has been set up to discuss this and other packages.
To subscribe, send an email to:
	[email protected]
A mailing list archive is available at:
	https://lists.untroubled.org/?list=bgware

Development versions of @PACKAGE@ are available at:
	https://github.com/bruceg/@PACKAGE@

Development of this version has been sponsored by FutureQuest, Inc.
[email protected]  https://www.FutureQuest.net/

Installation:

Check the build settings in the conf-* files and run "make".  As root,
run "make install".

On 32-bit Linux, to allow access to files 2GB and larger, make sure
-D_FILE_OFFSET_BITS=64 is in conf-cc.

Programs:

The package is broken down into two main programs: twoftpd-auth is a
front-end that only accepts USER and PASS (and a few other "built-in")
commands.  Once a user is authenticated, it execs a back end program,
typically twoftpd-xfer.  This program changes to the home directory in
$HOME, optionally does a chroot, and then drops root UID/GID to lock
down all privileges.

twoftpd-anon is a stripped-down version of twoftpd-xfer with all the
filesystem modification commands removed to allow for read-only FTP
access.  It may be used even without twoftpd-auth to provide an
anonymous FTP server.

twoftpd-drop is another reduced back end.  It allows only for uploading
new files.  Downloading, overwriting files, changing permissions,
renaming, etc are all forbidden.  All listings produce an empty result
to make it harder to guess which file names already exist.

Usage:

For a server handling only non-anonymous logins, optionally set CHROOT
and use:

	tcpserver -DHRv 0 ftp \
	/usr/local/bin/twoftpd-auth \
	/usr/local/bin/cvm-unix \
	/usr/local/bin/twoftpd-xfer

For a server handling only anonymous logins, set UID, GID, and HOME to
appropriate values, set CHROOT to 1, and set USER and GROUP to "ftp",
and use:

	tcpserver -DHRv 0 ftp /usr/local/bin/twoftpd-anon

If you want to have both anonymous and non-anonymous logins on the same
server, run both of the above two commands with two seperate IPs
substituted for the "0" parameter.  Because the FTP protocol does not
support name-based virtual hosting, multiple anonymous servers must be
run on separate IPs.

See the man pages for twoftpd-auth and twoftpd-xfer for more details.

Security notes:

Unless you have specific reason not to, always run with CHROOT or
SOFTCHROOT set.

Always run twoftpd (and most other servers) with resources limits in
effect.  For example:

	tcpserver -DRHv 0 ftp softlimit -m 2000000 twoftpd-anon

This will allow the server to consume up to 2MB of memory before being
killed, which should be enough for most OS's, and still prevent memory
overflow attacks.

This program is Copyright(C) @YEAR@ Bruce Guenter, and may be copied
according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a later
version.  A copy of this license is included with this package.  This
package comes with no warranty of any kind.