ftpd

file transfer daemon

[sudo] ftpd [-AdDhlMnPSU] [-T maxtimeout] [-t timeout] [-u mask]

-D detach and become a daemon, forking child processes to handle ftp connections. lower overhead than starting from inetd(8), useful on busy servers to reduce load.
-d Debugging to syslog
-l log sessions using syslog. Specify twice to log detail
-S logs anonymous transfers to /var/log/ftpd
-A anonymous only or accounts listed in /etc/ftpchroot. Other connection attempts are refused. not effective if PAM is enabled.
-h use data ports in the high port range for passive connections. the IPPORT_HIFIRSTAUTO and IPPORT_HILASTAUTO defines in <netinet/in.h>. In OpenBSD they are set to 49152 and 65535 respectively.
-M multihomed mode. a directory matching the fully qualified name of the IP number the client connected to, and located inside ~ftp
-n numeric IP addresses in logs
-P Permit illegal port numbers or addresses for PORT command initiated connects.
-T seconds timeout period request from client permittd; the maximum period allowed may be set to timeout seconds with the -T option. The default limit is 2 hours.
-t seconds timeout inactivity seconds
-u ogw umask default from 027 to iogw.

files

/etc/nologin disables ftp access. ftpd displays it and exits.
/etc/ftpwelcome output before issuing the ready message.
/etc/motd is displayed afterlogin
.message in a directory, is displayed it when that directory is entered.

Commands accepted from the control port

USER
PASS
CDUP change Directory UP to parent
CWD change working directory
HELP
LIST list files in a directory (ls -lgA)
MDTM show last MoDification TiMe of file
MODE STREAM, BLOCK or COMPRESSED
NLST name list of files in directory
PASV prepare for server -to -server transfer (passive) server suggests port
PORT specify PORT number for active transfet
TYPE translation characterset ASCII(default) includes end-of-line LF vs CR LF
EBCDIC,
No translation IMAGE, BINARY
RETR retrieve a file
STOR store a file
STOU store a file with a unique name
APPE append to a file
DELE delete a file
REST restart incomplete transfer
PWD print working directory
MKD make a directory
RMD remove a directory
RNFR specify rename -from file name
RNTO specify rename -to file name
SIZE size of file
STAT status of server
STRU specify data transfer structure DATA, RECORD or PAGE
SYST show operating system type of server system
ALLO allocate storage (vacuously)
NOOP do nothing
QUIT terminate session
ABOR abort
SITE non-standard commands (see next section) SITE commands
UMASK change umask, e.g. ``SITE UMASK 002''
IDLE set idle -timer, e.g. ``SITE IDLE 60''i
CHMOD change mode of a file, e.g. ``SITE CHMOD 755 filename''
HELP

globbing as used by csh. This allows users to utilize the metacharacters ``*?[]{}~''. authentication

  1. username must be in /etc/passwd, and not have a null password.
    If the user has an S/Key key, the response from a successful USER command will include an S/Key challenge. The client may choose to respond with a PASS command giving either a standard password or an S/Key one -time password. The server will automatically determine which type of password it has been given and attempt to authenticate accordingly. See skey(1) for more information on S/Key authentication.
  2. username must not appear /etc/ftpusers.
  3. The user must have a standard shell returned by getusershell(3).
  4. If the user username appears in the file /etc/ftpchroot the session's root will be changed to the user's login directory by chroot(2) as for an ``anonymous'' or ``ftp'' account (see next item). However, the user must still supply a password. This feature is intended as a compromise between a fully anonymous account and a fully privileged account. The account should also be set up as for an anonymous account.
  5. anonymous or ftp account must be present in the password file (user ``ftp''). In this case the user is allowed to log in by specifying any password (by convention an email address for the user should be used as the password). special measures to restrict the client's access privileges.
The server performs a chroot(2) to the home directory of the ftp user. the ftp subtree be constructed with care,
~ftp home directory owned by root and mode 555
. ~ftp/bin owned by root and mode 511. required, and should contain at least a statically linked copy of ls(1.) Programs in this directory should be mode 111 (executable only).
~ftp/etc Make this directory owned by ``root'' and mode 511). The files passwd(5) and group(5) must be present for the ls command to be able to produce owner names rather than numbers. The password field in passwd is not used, and should not contain real passwords. motd, printed after a successful login. These files should be mode 444.
~ftp/lib owned by root and mode 511. The libraries ld -linux.so.2 and libc.so.6 (or whatever your ls command is linked to) must be present. In order to read passwd(5) and group(5), the library libnss_files.so.2 is also needed. Note that if you're using a 2.2.* or later Linux kernel, ld -linux.so.2 must be executable as well as readable (555).
All other files should be mode 444.
~ftp/pub owned by ``root mode 555 . This is traditionally where publically accessible files are stored for download.

FILES

/etc/ftpusers
unwelcome/restricted users. /etc/ftpchroot users who should be chroot'd. /etc/ftpwelcomeWelcome notice. /etc/motd Welcome notice after login. /etc/nologin Displayed and access refused. /var/run/utmp List of users on the system. /var/log/ftpd Log file for anonymous transfers. SEE ALSO ftp(1), skey(1), who(1), getusershell(3), ftpusers(5), syslogd(8)

The server must run as the super -user to create sockets with privileged port numbers. It maintains an effective user ID of the logged in user, reverting to the super -user only when binding addresses to sockets.


Apple seems to have decided that it is not desirable to provide an easy method to start the ftp daemon, i.e. it is no longer in the system preferences sharing configuration.

to start the ftp daemon use: sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist following is from support.apple.com/kb/HT4704
to start the ftp daemon use: sudo launchctl load -w /System/Library/LaunchDaemons/ftp.plist sudo dseditgroup -o create -n /Local/Default -u dger com.apple.access_ftp sudo dseditgroup -o edit -u dge-a dgerman com.apple.access_ftp


See

VSftpD VerySecure ftp Daemon