FTPD(8)
π FTPD(8) π
okay so real talk: this is the manual page for ftpd, and it lives in the System Manager's Manual (that's section 8, bestie β admin territory π). It's long, so buckle up.
π NAME π
ftpd β Internet File Transfer Protocol server. that's it, that's the whole vibe.
β¨ SYNOPSIS β¨
ftpd [-AdDhlMnPSU] [-T maxtimeout] [-t timeout] [-u mask] [-z debug]
[-z debug=file] [-z certsok] [-z certrequired] [-z secure] [-z ssl]
[-z verify=flags] [-z cacert=cafile] [-z cert=certfile]
[-z key=keyfile] [-z cipher=list] [-z legacy]
πΈ DESCRIPTION πΈ
So ftpd is the Internet File Transfer Protocol server process, fr fr. It uses the TCP protocol and it listens at the port that's specified in the ftp service specification β go peek at services(5) for that, iykyk.
Here are the options you can hand it:
-4β IPv4 addressing only, no IPv6 energy today. The default is to offer service for both families, IPv6 and IPv4.-6β Only provide IPv6 addressing capability. IPv6 or nothing, periodt.-Aβ Permit only anonymous ftp connections, or accounts listed in/etc/ftpchroot. Every other connection attempt gets refused, sorry not sorry. Heads up though: this option is no longer effective if PAM is enabled π. Go read theREADMEfile for instructions on how to do this with PAM instead.-dβ Debugging info gets written to the syslog usingLOG_FTP.-Dβ With this set,ftpdwill detach and become a daemon, accepting connections on the FTP port and forking child processes to handle them. Lower overhead than startingftpdfrominetd(8), so it's genuinely useful on busy servers to reduce load π₯.-hβ The server will use data ports in the high port range for passive connections. That range is defined by theIPPORT_HIFIRSTAUTOandIPPORT_HILASTAUTOdefines in<netinet/in.h>. In OpenBSD they're set to49152and65535respectively.-lβ Every successful and failedftp(1)session gets logged using syslog with a facility ofLOG_FTP. And if you specify this option twice, it also logs the retrieve (get), store (put), append, delete, make directory, remove directory and rename operations, plus their filename arguments. Double the logging, double the tea β.-Mβ Enables multihomed mode. Instead of just using~ftpfor anonymous transfers, a directory matching the fully qualified name of the IP number the client connected to β and located inside~ftpβ is used instead. Fancy.-nβ Use numeric IP addresses in logs instead of doing a hostname lookup. Speedrun mode πβοΈ.-Pβ Permit illegal port numbers or addresses for PORT command initiated connects. By defaultftpd(8)violates the RFC and thus constrains the PORT command to non-reserved ports, and requires it use the same source address as the connection came from. This is what prevents the "FTP bounce attack" against services on both the local machine and other local machines. So likeβ¦ turning this on is a choice, bestie π¨.-Sβ With this option set,ftpdlogs all anonymous transfers to the file/var/log/ftpdwhen this file exists.-Uβ Each concurrentftp(1)session is logged to the file/var/run/utmp, making them visible to commands such aswho(1). BUT β this option at present is unsupported and will always silently fail π. It's giving decorative.-Tβ A client may also request a different timeout period; the maximum period allowed may be set to timeout seconds with the-Toption. The default limit is 2 hours.-tβ The inactivity timeout period is set to timeout seconds (the default is 15 minutes).-uβ Change the default umask from027to mask.-zSSL-parameter β This option is only valid ifftpdhas been built with SSL (Secure Socket Layer) support. Here's the whole menu:secureβ Don't fall back to unencrypted mode (that's without SSL) if the client isn't explicitly asking for SSL mode. In this server mode,ftpdonly accepts connections from SSL enhanced FTP clients with an option similar to-z securein active use. No vibes, only encryption π.sslβ Negotiate SSL at first, then fall back to legacy FTP protocol.nossl,!sslβ switch off SSL negotiation.debugβ Enable SSL related debugging. Useless in non-daemon mode.debug=fileβ Direct the debugging output to file.certsokβ Look username up in/etc/ssl.users. The format of this file is lines of this form:user1,user2:/C=US/...whereuser1anduser2are usernames. If the client certificate is valid, authenticate with any password. Use a commandopenssl x509 -noout -subjectto extract the needed fields, all of which are needed.certrequiredβ Client certificate is mandatory, and the user must be matched to the corresponding subject identifier listed in/etc/ssl.users.verify=intβ Set the SSL verify flags (use combinations ofSSL_VERIFY_*fromopenssl/ssl.h).cacert=ca_fileβ Use the CA certificates stored in ca_file to verify the identity of the peer client. The subject names found herein are given to the client for whatever use they may present. A clever client software is able to choose its identity hinted by this list.cert=cert_fileβ Use the certificate(s) in cert_file instead of the default location/etc/ftpd-ssl/ftpd.pem. This is a PEM formatted file. The first certificate identifies the server, and the rest of the chain is used for verification purposes while talking to the peer client.key=key_fileβ Use the key stored in key_file, should the certificate file not contain the required private key.cipher=ciph_listβ Set the preferred ciphers to ciph_list. Seeopenssl/ssl.hfor more information).legacyβ This is a compatibility option, which activates a work around during verification, which the legacy code depended on. It should not be used now that chains and CA lists are available, but is introduced to ease the transition to the better implementation. It's giving deprecated, bestie π« .
The file /etc/nologin can be used to disable ftp access. If that file exists, ftpd displays it and exits. If the file /etc/ftpwelcome exists, ftpd prints it before issuing the "ready" message. If the file /etc/motd exists, ftpd prints it after a successful login. And if the file .message exists in a directory, ftpd prints it when that directory is entered. Little welcome mats everywhere π‘β¨
The ftp server currently supports the following ftp requests. The case of the requests is ignored.
ABORβ abort previous commandACCTβ specify account (ignored)ALLOβ allocate storage (vacuously)APPEβ append to a fileCDUPβ change to parent of current working directoryCWDβ change working directoryDELEβ delete a fileEPRTβ specify data connection port, either IPv4 or IPv6EPSVβ ask for a server port for fetching dataHELPβ give help informationLISTβ give list files in a directory ("ls -lgA")MKDβ make a directoryMDTMβ show last modification time of fileMODEβ specify data transfer modeNLSTβ give name list of files in directoryNOOPβ do nothingPASSβ specify passwordPASVβ prepare for server-to-server transferPORTβ specify data connection portPWDβ print the current working directoryQUITβ terminate sessionRESTβ restart incomplete transferRETRβ retrieve a fileRMDβ remove a directoryRNFRβ specify rename-from file nameRNTOβ specify rename-to file nameSITEβ non-standard commands (see next section)SIZEβ return size of fileSTATβ return status of serverSTORβ store a fileSTOUβ store a file with a unique nameSTRUβ specify data transfer structureSYSTβ show operating system type of server systemTYPEβ specify data transfer typeUSERβ specify user nameXCUPβ change to parent of current working directory (deprecated)XCWDβ change working directory (deprecated)XMKDβ make a directory (deprecated)XPWDβ print the current working directory (deprecated)XRMDβ remove a directory (deprecated)
The following non-standard or UNIX specific commands are supported by the SITE request:
UMASKβ change umask, e.g. ``SITE UMASK 002''IDLEβ set idle-timer, e.g. ``SITE IDLE 60''CHMODβ change mode of a file, e.g. ``SITE CHMOD 755 filename''HELPβ give help information.
The remaining ftp requests specified in Internet RFC 959 are recognized, but not implemented. And heads up β MDTM and SIZE are not specified in RFC 959, but will appear in the next updated FTP RFC.
The ftp server will abort an active file transfer only when the ABOR command is preceded by a Telnet "Interrupt Process" (IP) signal and a Telnet "Synch" signal in the command Telnet stream, as described in Internet RFC 959. If a STAT command is received during a data transfer, preceded by a Telnet IP and Synch, transfer status will be returned.
Ftpd interprets file names according to the "globbing" conventions used by csh(1). This allows users to utilize the metacharacters "*?[]{}~" π¦.
Ftpd authenticates users according to five rules.
- The login name has to actually exist in the password database,
/etc/passwd, and it can not have a null password, bestie. If it's a real one, the client has to hand over a password before it's allowed to do anything file-related. And if the user has an S/Key key? The response from a successfulUSERcommand comes back with an S/Key challenge π . The client can then reply with aPASScommand carrying either a regular password or an S/Key one-time password, and the server will figure out all by itself which kind it got and try to authenticate accordingly. Want the tea on S/Key auth? Go readskey(1). S/Key is a Trademark of Bellcore, fyi. - The login name must not show up in the file
/etc/ftpusers. No gatecrashers allowed, periodt. - The user needs a standard shell β one that
getusershell(3)returns. If it doesn't come back from there, it's giving "not today" π«. - If the user name appears in
/etc/ftpchroot, the session's root gets changed to that user's login directory bychroot(2), exactly like it works for an "anonymous" or "ftp" account (peep the next item π). BUT β and this is the important part β the user still has to supply a password. This feature is literally designed as a compromise between a fully anonymous account and a fully privileged one. The account should also be set up the same way you'd set up an anonymous account. Iconic middle-ground energy β¨. - If the user name is "anonymous" or "ftp", there must be an anonymous ftp account present in the password file (user "ftp"). In that case the user gets to log in by specifying any password at all β by convention you'd use an email address for the user as the password π.
In that last case, ftpd pulls out the special measures to lock down what the client can touch. The server performs a chroot(2) to the home directory of the "ftp" user. And so that system security does not get breached, it is recommended β like, strongly, bestie β that the "ftp" subtree be constructed with care, following these rules:
~ftpβ Make the home directory owned by "root" and unwritable by anyone (mode555). Hands off π«Ά.~ftp/binβ Make this directory owned by "root" and unwritable by anyone (mode511). This directory is required, no skips, and should contain at least a statically linked copy ofls(1.). Any programs in here should be mode111(executable only).~ftp/etcβ Make this directory owned by "root" and unwritable by anyone (mode511). The filespasswd(5)andgroup(5)must be present, otherwiselscan't produce owner names instead of just numbers π. The password field inpasswdis not used, and should not contain real passwords β do not put your actual secrets in there, I am begging. The filemotd, if present, gets printed after a successful login. These files should be mode444.~ftp/libβ Make this directory owned by "root" and unwritable by anyone (mode511). The librariesld-linux.so.2andlibc.so.6(or whatever yourlscommand is linked to) must be present. And in order to readpasswd(5)andgroup(5), the librarylibnss_files.so.2is also needed. Heads up: if you're on a2.2.*or later Linux kernel,ld-linux.so.2must be executable as well as readable (555). All other files should be mode444.~ftp/pubβ Make this directory mode555and owned by "root". This is traditionally where publically accessible files are stored for download. The main character directory, honestly π.
π FILES π
/etc/ftpusersβ List of unwelcome/restricted users. The banned list π«./etc/ftpchrootβ List of normal users who should bechroot'd./etc/ftpwelcomeβ Welcome 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./etc/ftpd-ssl/ftpd.pemβ Default certificate and key for SSL authentication./etc/ssl.usersβ List of trusted users and their subject identifiers.
π± ENVIRONMENT π±
Ftpd accesses a single environment variable:
SSL_CIPHERβ containing a list of acceptable cipher combinations. That's it, that's the one π.
π SEE ALSO π
ftp(1), skey(1), who(1), getusershell(3), ftpusers(5), syslogd(8)
π BUGS π
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, and only reverts back to the super-user when it's binding addresses to sockets. The possible security holes have been extensively scrutinized, but are possibly incomplete. So likeβ¦ scrutinized, yes, but possibly incomplete β read that twice, bestie ππ.
π¦ HISTORY π¦
The ftpd command appeared in 4.2BSD. Ancient. Legendary. Grandmother of file transfer daemons, fr fr.
And that's a wrap on the FTPD(8) page, babes β¨ β this one's from Linux NetKit (0.17), dated September 14, 1999 (yes, a literal 90s icon π ), and it's filed under FTPD(8). Go forth and chroot responsibly ππ«Ά
π¦ where this page comes from
- debian bookworm: ftpd-ssl 0.17.36+really0.17-2 Β· BSD-4-clause-UC
- ubuntu jammy: ftpd-ssl 0.17.36+0.3-2.2build1
- ubuntu noble: ftpd-ssl 0.17.36+really0.17-2build2 Β· BSD-4-clause-UC
- ubuntu questing: ftpd-ssl 0.17.36+really0.17-3
- ubuntu resolute: ftpd-ssl 0.17.36+really0.17-5 Β· BSD-4-clause-UC
- ubuntu stonking: ftpd-ssl 0.17.36+really0.17-5build1 Β· BSD-4-clause-UC
- Copyright (c) 1985, 1988, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms