147462Scael.\" Copyright (c) 1985, 1988, 1991 The Regents of the University of California. 235560Sbostic.\" All rights reserved. 318965Smckusick.\" 443767Strent.\" %sccs.include.redist.man% 518965Smckusick.\" 6*54204Sbostic.\" @(#)ftpd.8 6.10 (Berkeley) 06/22/92 735560Sbostic.\" 847462Scael.Dd 947462Scael.Dt FTPD 8 1047462Scael.Os BSD 4.2 1147462Scael.Sh NAME 1247462Scael.Nm ftpd 1347462Scael.Nd 1447462Scael.Tn DARPA 1547462ScaelInternet File Transfer Protocol server 1647462Scael.Sh SYNOPSIS 1747462Scael.Nm ftpd 18*54204Sbostic.Op Fl dl 1947462Scael.Op Fl t Ar timeout 2047462Scael.Op Fl T Ar maxtimeout 2147462Scael.Sh DESCRIPTION 2247462Scael.Nm Ftpd 2347462Scaelis the 2447462Scael.Tn DARPA 2547462ScaelInternet File Transfer Protocol 2647462Scaelserver process. The server uses the 2747462Scael.Tn TCP 2847462Scaelprotocol 2947462Scaeland listens at the port specified in the 3047462Scael.Dq ftp 3118965Smckusickservice specification; see 3247462Scael.Xr services 5 . 3347462Scael.Pp 3447462ScaelAvailable options: 3547462Scael.Bl -tag -width Ds 3647462Scael.It Fl d 3747462ScaelDebugging information is written to the syslog. 3847462Scael.It Fl l 3947462ScaelEach 4047462Scael.Xr ftp 1 4147462Scaelsession is logged in the syslog. 4247462Scael.It Fl t 4347462ScaelThe inactivity timeout period is set to 4447462Scael.Ar timeout 4547462Scaelseconds (the default is 15 minutes). 4647462Scael.It Fl T 4736933SkarelsA client may also request a different timeout period; 4836933Skarelsthe maximum period allowed may be set to 4947462Scael.Ar timeout 5036933Skarelsseconds with the 5147462Scael.Fl T 5236933Skarelsoption. 5336933SkarelsThe default limit is 2 hours. 5447462Scael.El 5547462Scael.Pp 5618965SmckusickThe ftp server currently supports the following ftp 5736933Skarelsrequests; case is not distinguished. 5847462Scael.Bl -column "Request" -offset indent 5947462Scael.It Request Ta "Description" 6047462Scael.It ABOR Ta "abort previous command" 6147462Scael.It ACCT Ta "specify account (ignored)" 6247462Scael.It ALLO Ta "allocate storage (vacuously)" 6347462Scael.It APPE Ta "append to a file" 6447462Scael.It CDUP Ta "change to parent of current working directory" 6547462Scael.It CWD Ta "change working directory" 6647462Scael.It DELE Ta "delete a file" 6747462Scael.It HELP Ta "give help information" 6847462Scael.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA" 6947462Scael.It MKD Ta "make a directory" 7047462Scael.It MDTM Ta "show last modification time of file" 7147462Scael.It MODE Ta "specify data transfer" Em mode 7247462Scael.It NLST Ta "give name list of files in directory" 7347462Scael.It NOOP Ta "do nothing" 7447462Scael.It PASS Ta "specify password" 7547462Scael.It PASV Ta "prepare for server-to-server transfer" 7647462Scael.It PORT Ta "specify data connection port" 7747462Scael.It PWD Ta "print the current working directory" 7847462Scael.It QUIT Ta "terminate session" 7947462Scael.It REST Ta "restart incomplete transfer" 8047462Scael.It RETR Ta "retrieve a file" 8147462Scael.It RMD Ta "remove a directory" 8247462Scael.It RNFR Ta "specify rename-from file name" 8347462Scael.It RNTO Ta "specify rename-to file name" 8447462Scael.It SITE Ta "non-standard commands (see next section)" 8547462Scael.It SIZE Ta "return size of file" 8647462Scael.It STAT Ta "return status of server" 8747462Scael.It STOR Ta "store a file" 8847462Scael.It STOU Ta "store a file with a unique name" 8947462Scael.It STRU Ta "specify data transfer" Em structure 9047462Scael.It SYST Ta "show operating system type of server system" 9147462Scael.It TYPE Ta "specify data transfer" Em type 9247462Scael.It USER Ta "specify user name" 9347462Scael.It XCUP Ta "change to parent of current working directory (deprecated)" 9447462Scael.It XCWD Ta "change working directory (deprecated)" 9547462Scael.It XMKD Ta "make a directory (deprecated)" 9647462Scael.It XPWD Ta "print the current working directory (deprecated)" 9747462Scael.It XRMD Ta "remove a directory (deprecated)" 9847462Scael.El 9947462Scael.Pp 10047462ScaelThe following non-standard or 10147462Scael.Tn UNIX 10247462Scaelspecific commands are supported 10347462Scaelby the 10447462ScaelSITE request. 10547462Scael.Pp 10647462Scael.Bl -column Request -offset indent 10747462Scael.It Sy Request Ta Sy Description 10847462Scael.It UMASK Ta change umask. Em E.g. SITE UMASK 002 10947462Scael.It IDLE Ta set idle-timer. Em E.g. SITE IDLE 60 11047462Scael.It CHMOD Ta change mode of a file. Em E.g. 11147462ScaelSITE CHMOD 755 filename 11247462Scael.It HELP Ta give help information. Em E.g. SITE HELP 11347462Scael.El 11447462Scael.Pp 11547462ScaelThe remaining ftp requests specified in Internet 11647462Scael.%T "RFC 959" 11747462Scaelare 11818965Smckusickrecognized, but not implemented. 11936933SkarelsMDTM and SIZE are not specified in 12047462Scael.%T "RFC 959" , 12147462Scaelbut will appear in the next updated FTP RFC. 12247462Scael.Pp 12326051SminshallThe ftp server will abort an active file transfer only when the 12447462ScaelABOR 12547462Scaelcommand is preceded by a Telnet "Interrupt Process" (IP) 12626051Sminshallsignal and a Telnet "Synch" signal in the command Telnet stream, 12747462Scaelas described in Internet 12847462Scael.%T "RFC 959" . 12947462ScaelIf a 13047462ScaelSTAT 13147462Scaelcommand is received during a data transfer, preceded by a Telnet IP 13236933Skarelsand Synch, transfer status will be returned. 13347462Scael.Pp 13447462Scael.Nm Ftpd 13547462Scaelinterprets file names according to the 13647462Scael.Dq globbing 13718965Smckusickconventions used by 13847462Scael.Xr csh 1 . 13947462ScaelThis allows users to utilize the metacharacters 14047462Scael.Dq Li \&*?[]{}~ . 14147462Scael.Pp 14247462Scael.Nm Ftpd 14318965Smckusickauthenticates users according to three rules. 14447462Scael.Pp 14547462Scael.Bl -enum -offset indent 14647462Scael.It 14718965SmckusickThe user name must be in the password data base, 14847462Scael.Pa /etc/passwd , 14918965Smckusickand not have a null password. In this case a password 15018965Smckusickmust be provided by the client before any file operations 15118965Smckusickmay be performed. 15247462Scael.It 15318965SmckusickThe user name must not appear in the file 15447462Scael.Pa /etc/ftpusers . 15547462Scael.It 15628866SmckusickThe user must have a standard shell returned by 15747462Scael.Xr getusershell 3 . 15847462Scael.It 15947462ScaelIf the user name is 16047462Scael.Dq anonymous 16147462Scaelor 16247462Scael.Dq ftp , 16347462Scaelan 16418965Smckusickanonymous ftp account must be present in the password 16547462Scaelfile (user 16647462Scael.Dq ftp ) . 16747462ScaelIn this case the user is allowed 16818965Smckusickto log in by specifying any password (by convention this 16918965Smckusickis given as the client host's name). 17047462Scael.El 17147462Scael.Pp 17218965SmckusickIn the last case, 17347462Scael.Nm ftpd 17418965Smckusicktakes special measures to restrict the client's access privileges. 17518965SmckusickThe server performs a 17647462Scael.Xr chroot 2 17747462Scaelcommand to the home directory of the 17847462Scael.Dq ftp 17947462Scaeluser. 18018965SmckusickIn order that system security is not breached, it is recommended 18147462Scaelthat the 18247462Scael.Dq ftp 183*54204Sbosticsubtree be constructed with care, following these rules: 18447462Scael.Bl -tag -width "~ftp/pub" -offset indent 18547462Scael.It Pa ~ftp 18647462ScaelMake the home directory owned by 187*54204Sbostic.Dq root 18847462Scaeland unwritable by anyone. 18947462Scael.It Pa ~ftp/bin 190*54204SbosticMake this directory owned by 191*54204Sbostic.Dq root 192*54204Sbosticand unwritable by anyone. 193*54204SbosticThe program 19447462Scael.Xr ls 1 195*54204Sbosticmust be present to support the list command. 196*54204SbosticThis program should be mode 111. 19747462Scael.It Pa ~ftp/etc 198*54204SbosticMake this directory owned by 199*54204Sbostic.Dq root 200*54204Sbosticand unwritable by anyone. 201*54204SbosticThe files 20247462Scael.Xr passwd 5 20318965Smckusickand 20447462Scael.Xr group 5 20518965Smckusickmust be present for the 20647462Scael.Xr ls 20736933Skarelscommand to be able to produce owner names rather than numbers. 20836933SkarelsThe password field in 20947462Scael.Xr passwd 210*54204Sbosticis not used, and should not contain real passwords. 21136933SkarelsThese files should be mode 444. 21247462Scael.It Pa ~ftp/pub 21347462ScaelMake this directory mode 777 and owned by 21447462Scael.Dq ftp . 215*54204SbosticGuests 216*54204Sbosticcan then place files which are to be accessible via the anonymous 217*54204Sbosticaccount in this directory. 21847462Scael.El 21947462Scael.Sh SEE ALSO 22047462Scael.Xr ftp 1 , 22147462Scael.Xr getusershell 3 , 22247462Scael.Xr syslogd 8 22347462Scael.Sh BUGS 22418965SmckusickThe server must run as the super-user 22518965Smckusickto create sockets with privileged port numbers. It maintains 22618965Smckusickan effective user id of the logged in user, reverting to 22718965Smckusickthe super-user only when binding addresses to sockets. The 22818965Smckusickpossible security holes have been extensively 22918965Smckusickscrutinized, but are possibly incomplete. 23047462Scael.Sh HISTORY 23147462ScaelThe 23247462Scael.Nm 23347462Scaelcommand appeared in 23447462Scael.Bx 4.2 . 235