uftpd
—
No nonsense TFTP/FTP Server
uftpd |
[ -hnsv ]
[-l
LOG ]
[-o
ftp=PORT,tftp=PORT,writable ]
[-p
FILE ]
[PATH ] |
uftpd
is a very simple TFTP and anonymous FTP
server with inetd support. It listens on standard Internet ports for each
protocol, as defined in the system service specification,
/etc/services, unless other ports are given
on the command line. For details, see
services(5).
Without any command line arguments
uftpd
serves both FTP and TFTP and automatically backgrounds itself. Usually
uftpd
this means listen to port 21 (FTP)
and port 69 (TFTP), serve files from
/srv/ftp, and log to syslog. Messages are
written to the syslog using the
LOG_FTP
facility.
Available command line options:
-h
- Show built-in help text
-l
LOG
- Set log level: none, err, notice, info,
debug. By default the log level is
notice, which is less verbose than
info, but still logs all relevant events:
users logging in, uploading, downloading, creating and removing
directories, etc. To reduce the log level, start
uftpd
with
-l
error.
-n
- Run in foreground, do not detach from controlling terminal
-o
- Set
uftpd
option, separate multiple
options with comma:
- ftp=PORT
-
- tftp=PORT
-
- writable
-
- pasv_addr=ADDR
-
Override Internet ports otherwise derived from
services(5).
Set the PORT to zero (0) to disable a
service.
The writable option enables writable FTP
root, which is not recommended. Some people want this, but it is
recommended to instead rely on a writable sub-directory, like
upload/, or similar.
An address passed to the client in passive mode can be overridden with the
pasv_addr option (real data socket
address remains unchanged). This may be useful for passing through some
types of NAT.
-p
FILE
- File to store process ID for signaling
uftpd
. The default depends on how
uftpd
was configured at build time, and
also the UNIX system it runs on, but often it is found in
/var/run/uftpd.pid.
-s
- Use syslog, even if running in foreground, default when running in the
background
-v
- Show program version
- PATH
- Root directory. The default is to serve files from the FTP user's $HOME.
When started as root
uftpd
will chroot
to this directory as a security measure.
uftpd
can also be used with an Internet
superserver, like the traditional inetd or modern init replacements like
finit. In inetd mode the server takes client connections from stdin. To enable
inetd mode
uftpd
must be called as either
in.tftpd
or
in.ftpd
. In inetd mode
uftpd
always runs in the foreground with
syslog for messages.
The file
/etc/nologin can be used to disable
FTP access. If the file exists,
uftpd
displays it and exits. If the file
/etc/ftpwelcome exists,
uftpd
prints it before issuing the
“ready” message. If the file
/etc/motd exists,
uftpd
prints it after a successful login.
If the file
.message exists in a directory,
uftpd
prints it when that directory is
entered.
The FTP server currently supports the following requests. The case of the
requests is ignored.
Request |
Description |
ABOR |
abort current transfer |
CDUP |
shorthand for CD .. command |
CWD |
change working directory |
CLNT |
accepted and ignored by server |
DELE |
delete a file |
EPRT |
RFC 2428, extended PORT command |
EPSV |
extended PASV command, used by VLC for Android |
FEAT |
list supported features |
HELP |
show help text |
LIST |
give list files in a directory (“ls
-lgA ”) |
MDTM |
RFC 3659, return the last-modified time of a file |
MLST |
RFC 3659 extension to LIST |
MLSD |
RFC 3659 extension to LIST |
MKD |
make a directory |
NLST |
like LIST, but much less verbose |
NOOP |
do nothing, used for keep-alive |
PASS |
specify password |
PASV |
prepare for server-to-server transfer |
PORT |
specify data connection port |
PWD |
print the current working directory |
QUIT |
terminate session |
REST |
restore RETR or STOR command at file offset |
RETR |
retrieve a file |
RMD |
remove a directory |
RNFR |
specify rename-from file name |
RNTO |
specify rename-to file name |
SIZE |
return size of file |
STOR |
store a file |
SYST |
show operating system type of server system |
TYPE |
specify data transfer type |
USER |
specify user name |
Remaining FTP requests, as specified in Internet RFC959, are not recognized at
the moment. Patches are welcome!
uftpd
also supports TFTP, the Trivial File
Transfer Protocol, which is often used for net booting diskless devices, e.g.,
BOOTP and PXEBOOT.
The TFTP server currently supports the following requests.
Request |
Description |
RRQ |
Read Request for file, may have options |
WRQ |
Write Request for file, may have options |
DATA |
File data, preceded by block n:o |
ERROR |
Error, end of session |
ACK |
ACKnowledge DATA or WRQ without options |
OACK |
Option acknowledged, sent as response to RRQ/WRQ |
uftpd
supports TFTP blocksize negotiation,
according to RFC2348, so full sized Ethernet frames can be used, which greatly
speeds up transfers.
- /etc/ftpwelcome
- FTP Welcome notice.
- /etc/motd
- Message of the day, presented after successful FTP login.
- /etc/nologin
- Displayed to user attempting to connect. Access is refused if this file
exists.
- /var/run/uftpd.pid
- Program default PID file, created only when
uftpd
is ready with its internal setup
and able to service signals. Note,
uftpd
exits on most signals. So no
special processing is done atm.
ftp(1),
tftp(1),
syslogd(8)
uftpd
was written by Joachim Wiberg
⟨mailto:troglobit@gmail.com⟩ and is maintained at
⟨https://github.com/troglobit/uftpd⟩
Here be dragons.