\input texinfo  @c -*-texinfo-*-
@c %**start of header
@setfilename muddleftpd.info
@settitle muddleftpd, a file transfer protocol server
@dircategory Internet
@c %**end of header

@c This file has the new style title page commands.
@c Run `makeinfo' rather than `texinfo-format-buffer'.

@c smallbook

@c tex
@c \overfullrule=0pt
@c end tex

@c Combine indices.
@synindex cp fn
@syncodeindex vr fn
@syncodeindex ky fn
@syncodeindex pg fn
@syncodeindex tp fn
@defindex ci

@ifinfo
This file documents @sc{muddleftpd}, a file transfer protocol server.

Copyright (C) 1999 Jonas Öberg and Beau Kuiper

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

@ignore
Permission is granted to process this file through TeX and print the
results, provided the printed document carries copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).

@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
@end ifinfo

@setchapternewpage off

@titlepage
@title muddleftpd, a file transfer protocol server

@author by Jonas Öberg and Beau Kuiper
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1999 Jonas Öberg and Beau Kuiper

@sp 2
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
@end titlepage
@page

@node Top, Introduction, (dir), (dir)

This file documents the @sc{muddleftpd} program, a server for the Internet
File Transfer Protocol. This is edition 1.1 for Muddleftpd version 1.1.

@menu
* Introduction::                Introduction
* Invocation::                  How to invoke muddleftpd
* Site Configuration::          How to configure the program
* Troubleshooting::             Troubleshooting the server
* FTP Commands::                FTP Commands implemented in the server
* Magic Cookies::               Magic Cookies used in values and files
* Reporting Bugs::              Reporting bugs
* Directive Index::             Index of configuration file directives
@end menu

@node Introduction, Invocation, Top, Top
@comment  node-name,  next,  previous,  up
@chapter Introduction

@sc{muddleftpd} is a server for the Internet File Transfer Protocol.
Normal FTP servers tend to always want to run with root privileges
on the server host. @sc{muddleftpd} is designed to overcome this obstacle
without limiting the available features when running without root
privileges.

This manual describes version 1.1 of the program.

@node Invocation, Site Configuration, Introduction, Top
@chapter Invocation

Neither the server program, @sc{muddleftpd}, or the special information
program, @sc{ftpwho} takes any special arguments except the name of the
configuration file to use. If no configuration file is specified on the
command line, both programs will try to open the default configuration file.

@node Site Configuration, Troubleshooting, Invocation, Top
@chapter Site Configuration

@sc{muddleftpd} uses two different configuration files. The main configuration
file and the user configuration files. They both use a simple format where
lines consist of two items separated by space (key and value).  There can
only be one pair of key and value on each line. Comments start with the
@samp{#} character and continue until the end of the line. Values can
include spaces by escaping them with the @samp{\} character as is shown
in the example below.

@example
	# The \ allows space to be recognized as part of the value
	access  /etc/name\ spaced
@end example

@menu
* Main config::                 Main configuration file
* User config::                 User configuration files
@end menu

@node Main config, User config, , Site Configuration
@chapter Main config

The main config file is read when muddleftpd is first started. It contains
information that applies to the entire program. Some options can be declared
several times in the configuration file to add more values.

@menu
* ftpport::             Specify a port to bind to
* maxusers::            Maximum user count
* logstrength::         The messages to send to main log
* runasuid::            The uid to run as
* runasgid::            The gid to run as
* logfile::             The name of the log file
* accessdir::           Directory for user configuration files
* timeout::             Default timeout value
* addhost::             Allow access to a range of IP numbers
* logindump::           File that gets printed when a user connects
* pidfile::             File that will store muddleftpds pid number
* email::               Email address of the ftp archive maintainer
@end menu

@node ftpport, maxusers, , Main config
@chapter ftpport
@ciindex ftpport
 @itemize @bullet
 @item Accepted value: (port)/(ip) | (port)
 @item Default: none
 @end itemize

@samp{ftpport} tells the server that it should try to listen on @samp{port}
for connections. You may specify this directive more than once to listen
on more than on port. For each @samp{ftpport} directive, you may also specify
the IP number of the interface on which @sc{muddleftpd} should accept
connections. @sc{muddleftpd} will refuse to start if you don't specify
atleast one @samp{ftpport} directive.

Examples:
@example
ftpport	21	#listen to port 21 for connections
ftpport 121/127.0.0.1	#listen to port 121 only on the loopback
			#device
ftpport 4990/10.1.1.1	#listen to port 4990 only on the ethernet
			#device with IP 10.1.1.1
@end example

@node maxusers, logstrength, ftpport, Main config
@chapter maxusers
@ciindex maxusers
 @itemize @bullet
 @item Accepted value: (maximum user count)
 @item Default: 30
 @end itemize

@samp{maxusers} tells the server the maximum number of users that
@sc{muddleftpd} will allow to connect at any one time. When the maximum number
of users have been reached, all subsequent connections will be silently
dropped to prevent resource wastage. If you are setting up an anonymous FTP
server, you should have maxusers higher that anonymous's maxusers. This way,
a full FTP server doesn't rudely drop connections.

@node logstrength, runasuid, maxusers, Main config
@chapter logstrength
@ciindex logstrength
 @itemize @bullet
 @item Accepted value: (logvalue)
 @item Default: 1
 @end itemize

@samp{logstrength} tells the server what information to log. The value for
this option is the sum of any of the following types:

@multitable @columnfractions .10 .9
@item 1 @tab Clients that try to access the server from invalid	ip addresses
@item 2 @tab File transfers, uploads and downloads.
@item 4 @tab Commands the user sends to the server.
@item 8 @tab The replies the server sends to the user.
@item 16 @tab General Information logs (server starting and stopping)
@item 32 @tab Login information, including successful and denied logins.
@end multitable

Examples:
@example
logstrength 63		# log everything
logstrength 0		# log nothing
logstrength 51		# log everything except user commands
			# and server replies
@end example

@node runasuid, runasgid, logstrength, Main config
@chapter runasuid
@ciindex runasuid
 @itemize @bullet
 @item Accepted value: (uid)
 @item Default: (none)
 @end itemize

When setting the directive, the server will attempt to change the user
id to @samp{uid}. This is usually used to bind
to a privileged port number before switching to another user for user access.
This may break some pedantic clients or firewalls, but these 
are few and far between. If you don't specify this directive, then the
server will run with whatever permissions it has when it starts.

Examples:
@example
runasuid 65535		# run as nobody
@end example

@node runasgid, logfile, runasuid, Main config
@chapter runasgid
@ciindex runasgid
 @itemize @bullet
 @item Accepted value: (gid)
 @item Default: (none)
 @end itemize

When setting the directive, the server will attempt to change the user
group id to @samp{uid}. This is usually used to bind
to a privileged port number before switching to another user for user access.
This may break some pedantic clients or firewalls, but these 
are few and far between. If you don't specify this directive, then the
server will run with whatever permissions it has when it starts.

Examples:
@example
runasgid 65535          # run as the group nogroup
@end example

@node logfile, accessdir, runasgid, Main config
@chapter logfile
@ciindex logfile
 @itemize @bullet
 @item Accepted value: (filename)
 @item Default: @file{/var/log/muddleftpd.log}
 @end itemize

This directive tells @sc{muddleftpd} where to store its log file. The server
will append to the specified file. This file must exist and be writable to the 
starting user, otherwise @sc{muddleftpd} will refuse to start and exit.

Examples:
@example
logfile /home/rugger/ftpd/ftpd.log  # store logs in an alternative
				    # place
@end example

@node accessdir, timeout, logfile, Main config
@chapter accessdir
@ciindex accessdir
 @itemize @bullet
 @item Accepted value: (directory)
 @item Default: @file{/usr/local/etc}
 @end itemize

@samp{accessdir} tells @sc{muddleftpd} where to find the configuration files
describing user access to the server. It must be readable to the running user
or @sc{muddleftpd} will be unable to autenticate any users.

Examples:
@example
accessdir /etc/muddleftpd	# files are stored in /etc/muddleftpd
accessdir /home/rugger/ftpd	# files are stored in 
				# /home/rugger/ftpd
@end example

@node timeout, addhost, accessdir, Main config
@chapter timeout
@ciindex timeout
 @itemize @bullet
 @item Accepted value: (seconds)
 @item Default: 300 seconds
 @end itemize

@samp{timeout} gives the default timeout for a user connection. This timeout
will apply before the user logs in, and will persist if timeout isn't
configured in the user configuration files.

Examples:
@example
timeout 20		# users must log in within 20 seconds
timeout 3600		# 1 hour timeout
@end example

@node addhost, logindump, timeout, Main config
@chapter addhost
@ciindex addhost
 @itemize @bullet
 @item Accepted value: (ip address)/(netmask)
 @item Default: (none)
 @end itemize

@samp{addhost} tells the server to allow access to a given subnet. By default,
@sc{muddleftpd} denies access to all hosts.

Examples:
@example
addhost 192.203.224.0/255.255.255.0
	# allow access to all hosts from 192.203.224.X
addhost 76.2.0.0/255.255.0.0
	# allow access to all hosts from 76.2.X.X
addhost 10.2.9.34/255.255.255.255
	# allow access to host 10.2.9.34
addhost 0.0.0.0/0.0.0.0
        # allow access to everyone
@end example

@node logindump, pidfile, addhost, Main config
@chapter logindump
@ciindex logindump
 @itemize @bullet
 @item Accepted value: (filename)
 @item Default: (none)
 @end itemize

@samp{logindump} specifies what file will be displayed to the user before
the user logs in. All normal magic cookies are available (except %C) for use,
although the information in many of them is useless until the user logs in.
@xref{Magic Cookies}.
This can be used to display welcome messages and information to the user 
before he or she logs in.

Examples:
@example
logindump /etc/issue	 # display the issue file
logindump /etc/issue.ftp # display this file
@end example

@node pidfile, email, logindump, Main config
@chapter pidfile
@ciindex pidfile
 @itemize @bullet
 @item Accepted value: (filename)
 @item Default: @file{/var/run/muddleftpd.pid}
 @end itemize

@samp{pidfile} defines the file that you wish to store the pid of the main
@sc{muddleftpd} process in. It is required to determine if @sc{muddleftpd} is
already running with a particular config file. If one can not be created, the
server will abort and refuse to run. @samp{pidfile} MUST not be in a directory
where other users can create links.

Examples:
@example
pidfile /home/rugger/pids/muddleftpd.pid
		# store the pid file here
@end example

@node email, , pidfile, Main config
@chapter email
@ciindex email
 @itemize @bullet
 @item Accepted value: (email address)
 @item Default: @samp{<unknown>}
 @end itemize

@samp{email} is where you provide an email address that is stored in the magic
cookie %E. @xref{Magic Cookies}. You can specify anything you want.

Examples:
@example
email ekuiperba@@cc.curtin.edu.au
email I\ don't\ want\ to\ tell\ you!	# just a string
@end example

@node User config, , Main config, Site Configuration
@chapter User config

The user configuration files define almost everything about a user connection
to the ftp server. This includes home directory, root directory, password and
file access rights. @sc{muddleftpd} will have at least one ofthese files,
and will load them in the following order:

@enumerate
@item @file{user.<username>}
@item @file{user.default}
@end enumerate

@file{user.default} will be loaded if @sc{muddleftpd} can not find the first
configuration file. Note that if @file{user.default} doesn't exist, then an
error message will be written to the log.

You can also create @file{group.<groupname>} files that can be used as
templates for @file{user.<username>} files. If you specify a group template
file in the @file{user.<username>} file, then the @file{group.<groupname>}
file will be loaded AFTER the @file{user.<username>} file has been parsed.

If you specify a directive more than once in a user config file, then the 
first one will be the one that the server recognizes.

User files also use magic cookies to improve configurablity.
@xref{Magic Cookies}.

@menu
* group::               Specify what group template file to use
* password::            Set the user's encrypted password
* rootdir::             Set the user's root directory
* homedir::             Set the user's home directory
* welcome::             Set what file is dumped when the user logs in
* access::              Add an entry to the ACL table
* umask::               Set the default umask for all created files
* unixuser::            Set the username to read magic tokens from
* maxconnect::          Set the maximum number of times this user can connect
* utimeout::            Set this users timeout
* permissions::         Set the uid and/or gid this user will access files as
* dumpfiles::           Dump files for various events and actions
* chmoding::            Set ability to change umask and file permissions
@end menu

@node group, password, , User config
@chapter group
@ciindex group
 @itemize @bullet
 @item Accepted value: (group name)
 @item Default: (none)
 @end itemize

@samp{group} tells the server to load the file @file{group.(groupname)} after
processing all the directives in the user configuration file. This lets you
use templates that multiple user configuration files can use. If this group
file doesn't exist, a log entry will be generated. These group files are kept
in the same directory as the user config files.

Examples:
@example
group users	# read the file group.users
group <none>	# use no group file
@end example

@node password, rootdir, group, User config
@chapter password
@ciindex password
 @itemize @bullet
 @item Accpted value: (encrypted password)
 @item Default: @samp{%p}
 @end itemize

@samp{password} specifies the password (in encrypted form) that the user must
enter to successfully log on. If you specify @samp{*}, the username is
disabled. if you specify @samp{<none>}, then any password is accepted.

Examples:
@example
password %p	# use the normal password from /etc/passwd
password %s	# use a shadow password. 
password <none>	# accept any password.
@end example

@node rootdir, homedir, password, User config
@chapter rootdir
@ciindex rootdir
 @itemize @bullet
 @item Accepted value: (directory)
 @item Default: @file{/}
 @end itemize

@samp{rootdir} specifies the root directory for this user. The user will not
be able to access directories above this directory (unless a symbolic link
exists to an outside directory, where that directory and its children will
be visible).

Examples:
@example
rootdir %h 	# use the home directory as the root directory.
rootdir /home/ftp # use /home/ftp as the root directory.
rootdir /	# use / as the root directory.
@end example

@node homedir, welcome, rootdir, User config
@chapter homedir
@ciindex homedir
 @itemize @bullet
 @item Accepted value: (directory)
 @item Default: @samp{%h}
 @end itemize

@samp{homedir} is the directory the server will place a user in after they
have been successfully authenticated. It is
relative to @samp{rootdir} (eg if @samp{homedir} is @file{/cow} and
@samp{rootdir} is @file{/mad}, then the
login directory will be @file{/mad/cow}). The user can also use @samp{~} to
access their home directory.

Examples:
@example
homedir %h 	# set home directory to the passwd home directory
homedir /	# use / as the home directory.
@end example

@node welcome, access, homedir, User config
@chapter welcome
@ciindex welcome
 @itemize @bullet
 @item Accepted value: (filename)
 @item Default: (none)
 @end itemize

@samp{welcome} specifies the file that the user will see when he or she logs
in. It is an absolute filename (no relation to rootdir). File magic cookies
apply to this file. @xref{Magic Cookies}.

Examples:
@example
welcome /etc/ftpwelcome
welcome /home/ftp/welcome.txt
@end example

@node access, umask, welcome, User config
@chapter access
@ciindex access
 @itemize @bullet
 @item Accepted value: (filename or directory):(keys)
 @item Default: no access.
 @end itemize

@samp{access} controls the ACL access layer that @sc{muddleftpd} places above
unix file system permissions. (filename or directory) specify the filename or
directory to which these restrictions apply. (keys) specify which access rights
to grant to the user in this directory or file. (filename or directory) is
relative to rootdir.

If a filename is specified, then the access will apply only to that file.
If a directory is specified by ending (filename or directory) with a @samp{/},
then the access directive will apply to all files and subdirectories of that
directory. 

The default is to give no access. To allow unix permission define access, use

@example
access /:ALL
@end example

in the user configuration file. The following keys are available:

@multitable @columnfractions .10 .9
@item R @tab Read file or directory
@item L @tab List files (only meaningful for directories)
@item A @tab Add new files (only meaningful for directories)
@item W @tab Write access.
@item D @tab Delete file access (only meaningful for directories)
@item X @tab Do not override this ACL (if one exists in the group file)
@item
@item ALL @tab All attributes except X
@item NONE @tab No attributes (no access)
@end multitable


Examples:
@example
access /etc/ftpwelcome:R # give read access to /etc/ftpwelcome
access /etc/:R           # give read access to all files in /etc/
access /incoming/:A      # give add file access to /incoming
access /:ALL             # give full access to all files, dirs.
access /secret/:NONE     # don't give access to any files in /secret.
@end example

@node umask, unixuser, access, User config
@chapter umask
@ciindex umask
 @itemize @bullet
 @item Accepted value: (octal integer)
 @item Default: umask when @sc{muddleftpd} was started
 @end itemize

@samp{umask} specifies what attributes files and directories will be given
when they are created. @samp{umask} specifies what bits are not set.

Examples:
@example
umask 077	# only user bits are set on new file creation
umask 666	# all new files are set non-accessible.
@end example

@node unixuser, maxconnect, umask, User config
@chapter unixuser
@ciindex unixuser
 @itemize @bullet
 @item Accepted value: (username)
 @item Default: (none)
 @end itemize

@samp{unixuser} specifies what username to load the magic cookies from.
It loads these cookies from the password file (@file{/etc/passwd}) with
(username). The only magic cookie available to this directive %U.
@xref{Magic Cookies}.

Examples:
@example
unixuser %U	# use the entered username as the unix username
unixuser ftp	# use the user ftp for all the cookies
@end example

@node maxconnect, utimeout, unixuser, User config
@chapter maxconnect
@ciindex maxconnect
 @itemize @bullet
 @item Accepted value: (count)
 @item Default: (no limit)
 @end itemize

@samp{maxconnect} controls how many people with the same username can log in
at the same time (NOTE: This restribution is per username and not per
configuration file). If this value is reached, user trying to connect
will be denied access and @samp{busydump} will be returned to the user.

Examples:
@example
maxconnect 10		
maxconnect 150
@end example

@node utimeout, permissions, maxconnect, User config
@chapter utimeout
@ciindex utimeout
 @itemize @bullet
 @item Accepted value: (seconds)
 @item Default: the main configuration timeout value
 @end itemize

This sets the @samp{utimeout} for this specific user. Any sessions
will automaticly be disconnected after this period of inactivity.

Examples:
@example
utimeout 600	# set user timeout to 10 minutes
utimeout 7200	# set user timeout to 2 hours.		
@end example

@node permissions, dumpfiles, utimeout, User config
@chapter permissions
@ciindex uid
@ciindex gid
 @itemize @bullet
 @item Accepted value: (integer)
 @item Default: %u | %g
 @end itemize

The @samp{uid} and @samp{gid} directives sets the user and group id that all
user requests file accesses will be performed as. Note: The server will not
accept uid 0 (root) and will automatically change it to -1 (nobody). gid 0
(root or wheel) will be changed to -1 (nogroup).

Examples:
@example
uid 20		# use user id 20 for all file access.
uid %u		# use the user id from the password file.
gid 20		# use group id 20 for all file access.
gid %g		# use the group id from the password file.
@end example

@node dumpfiles, chmoding, permissions, User config
@chapter dumpfiles
@ciindex cddump
@ciindex busydump
@ciindex quitdump
 @itemize @bullet
 @item Accepted value: (filename)
 @item Default: (none)
 @end itemize

The @samp{cddump}, @samp{busydump} and @samp{quitdump} directives specify
what files to send to the user when they perform
a number of actions or when a certain event occurs. @samp{cddump} specifies
the file to send when a change directory action is performed.
@samp{busydump} specifies the file to send when @samp{maxconnect} number of
users are already connected. @samp{quitdump} specifies the file to send
when the user disconnects from the ftp service.

File magic cookies apply to these files. @xref{Magic Cookies}.

Examples:
@example
cddump .message		# show .message in the directory the user
			# changes to.
busydump /etc/ftpbusy
quitdump /etc/ftpbye
@end example

@node chmoding, , dumpfiles, User config
@chapter chmoding
@ciindex chmoding
 @itemize @bullet
 @item Accepted value: 0 | 1
 @item Default: 0
 @end itemize

If @samp{chmoding} is set to 1, the user is allowed to change the umask and
change permissions on files.

Examples:
@example
chmoding 0	# disable chmod and umask changing
chmoding 1	# enable chmod and umask changing
@end example

@node Troubleshooting, FTP Commands, Site Configuration, Top
@chapter Troubleshooting

If problems occur while compiling, check the following:

@itemize @bullet
@item
If you are running OpenLinux 2.2, make sure that you have downloaded and
installed the crypt package. Get it from:
@url{ftp://ftp.linuxland.de/pub/OpenLinux/crypto/2.2/glibc-crypt-2.1-3i.i386.rpm}
@end itemize

If you get either of these messages when running the sever:

@table @samp
@item muddleftpd error in file init.c line 51: muddleftpd already running!

This means that you are already running a copy of muddleftpd using the
configuration file muddleftpd tried to open. (That is, the default
compiled in config file, or what you specified on the command line).
Simply close down the old version (with a SIGTERM) and start it again.

@item muddleftpd error in file shmem.c line 91: Permission denied

This means that muddleftpd could not get write permission on the main
configuration file (It is used for locking the shared memory). You must
give the user running muddleftpd write permission to the main config file
muddleftpd will be running as.

@end table

@node FTP Commands, Magic Cookies, Troubleshooting, Top
@chapter FTP Commands

The following commands are understood and used by muddleftpd:

@multitable @columnfractions .20 .8
@item PORT @tab Define the data port the server will connect to
@item PASV @tab Tell the server that the next data connection will
use passive mode
@item RETR @tab Retreive a file from the server
@item STOR @tab Store a file on the server
@item STOU @tab Store a file on the server using an unique filename
@item APPE @tab Append to a file on the server
@item TYPE @tab Specify what type to transfer data (A = Ascii, B = binary)
@item QUIT @tab Quit the ftp server
@item PASS @tab Password to log on using
@item USER @tab Username to log on using
@item SYST @tab Returns the system type muddleftpd is running on (UNIX)
@item LIST @tab Do a long list over a data connection
@item NLST @tab Do a short list over a data connection
@item PWD  @tab see XPWD
@item XPWD @tab Return the current directory
@item CWD  @tab see XCWD
@item XCWD @tab Change the working directory
@item ABOR @tab Abort a data connection in progress
@item CDUP @tab Change to the parent directory.
@item XCUP @tab see CDUP
@item STAT @tab return server status or a listing over the control connection.
@item NOOP @tab Do nothing
@item REIN @tab Reinitalize the server for a new user
@item REST @tab Resume a data transfer at a particular position
@item DELE @tab Delete a file
@item MKD  @tab see XMKD
@item XMKD @tab make a new directory
@item RMD  @tab see XRMD
@item XRMD @tab remove a directory
@item RNFR @tab set the file to rename
@item RNTO @tab set the name to rename to
@item SIZE @tab get the size of a file using the current TYPE setting
@item MDTM @tab get the modification time of a file
@item HELP @tab show list of recognized commands
@item SITE DUMP	@tab display a file over the control connection
@item SITE ACCESS @tab show ACLs of the current user
@item SITE HELP	@tab show recognised site commands
@item SITE UMASK @tab set the umask
@item SITE CHMOD @tab change the permissions of a file
@end multitable

Commands recognised but ignored in muddleftpd

@multitable @columnfractions .20 .8
@item ALLO @tab Allocate space (not needed)
@item ACCT @tab Account	name (not needed)
@end multitable

@node Magic Cookies, Reporting Bugs, FTP Commands, Top
@chapter Magic Cookies

Magic cookies are used in @sc{muddleftpd} user config files and in files
displayed to the user. Magic cookies recognized in files are replaced with
the values they represent as @sc{muddleftpd} parses them. eg:

@example
my email is %E
@end example

has the magic cookie %E. Since %E represents the FTP server maintainer's
email address, @sc{muddleftpd} would create the following:

@example
my email is ekuiperba@@cc.curtin.edu.au
@end example

All magic cookies in @sc{muddleftpd} start with a % char. There are 2 formats
available:

The %x Format:

This format is simplest syntax and simply replaces the cookie (%x) with the
entire string that represents the character x.

The %(m,n)x Format:

This format selects a range of characters from the string cookie (%x)
represents. m is the first character to insert and n is the last character
to insert from cookie x. The first character in a magic cookie is numbered
is 0. m and n are both adjusted so m >= 0 and n <= length of the Magic
cookie. @xref{Magic Cookies}. if n > m, then the cookie is considered invalid, see below.

eg.

@multitable @columnfractions .20 .8
@item %(0,5)u @tab will give the first six characters of what magic cookie
u represents.
@item %(10,10)E @tab returns the 11th character of what cookie E represents.
@item %(6,8)M @tab returns the 7th to 9th characters from what cookie M represents.
@item %(10,8)F @tab This is invalid because n > m.
@end multitable

Invalid Syntax:

If @sc{muddleftpd} determines that a magic cookie is invalid (ie, it doesn't 
exist or is the format is bad), then the line where the magic cookie was
found will not be parsed and an entry (informational) will be added to the log.

The following magic cookies are recognized in dumped files:

@multitable @columnfractions .1 .9
@item %T @tab The current time in the format: Wed Jan 30 21:49:08 1993
@item %U @tab The username the user used to login
@item %C @tab The current directory of the user
@item %E @tab The administrators email, set in the main config file
@item %M @tab The maximum number of users muddleftpd will log on at a time
@item %N @tab The current number of users logged into this muddleftpd server.
@item %R @tab The string representation of the remote user's IP
(muddleftpd doesn't do reverse name lookup on users)
@item %L @tab The full hostname of the host muddleftpd is running on
@item %f @tab The number of files the user has downloaded
@item %F @tab The number of files the user has uploaded
@item %b @tab The number of bytes the user has downloaded, downloading files.
@item %B @tab The number of bytes the user has uploaded, uploading files
@item %I @tab The number of bytes the user has downloaded, from listings
@item %i @tab The number of listings the user has downloaded
@item %D @tab The total number of bytes downloaded (listing and file downloads) over data connections.
@item %d @tab The total number of connections opened for downloading (listing and file downloads)
@item %t @tab The total number of bytes transfered (listing, uploading and downloading) over data connections
@item %c @tab The total number of data connections made (for listing, uploading and downloading)
@end multitable

You can also use the %(m,n)x format on any of the above cookies. (although
doing so may not be useful for many of the cookies) The %C magic cookie is
invalid during the logindump file, because the user has no
current directory before startup.

To make user configuration files flexable, a set of magic cookies are accepted
in these files. Most of these magic cookies get read from the password file.

The following magic cookies are recognized in config files:

@multitable @columnfractions .1 .9
@item %U @tab The username of the connecting party
@item %p @tab The encrypted password from the normal password file
@item %s @tab The encrypted password from the shadow password file
(if your system uses shadow passwords)
@item %u @tab The uid from the password file
@item %g @tab The gid from the password file
@item %h @tab The home directory from the password file.
@end multitable

You can also use the %(m,n)x format on any of the above cookies. (although
doing so may not be useful for many of the cookies) For the unixuser 
directive, only %U will be avaliable. unixuser will load the other cookies
thought.

@node Reporting Bugs, Directive Index, Magic Cookies, Top
@chapter Reporting Bugs

Report bugs to Beau Kuiper <ekuiperba@@cc.curtin.edu.au>.

@node Directive Index, , Reporting Bugs, Top
@chapter Directive Index
@printindex ci

@contents
@bye
