161425Sbostic.\" Copyright (c) 1985, 1988, 1991, 1993 261425Sbostic.\" The Regents of the University of California. All rights reserved. 318965Smckusick.\" 443767Strent.\" %sccs.include.redist.man% 518965Smckusick.\" 6*67321Sah.\" @(#)ftpd.8 8.3 (Berkeley) 06/01/94 735560Sbostic.\" 847462Scael.Dd 947462Scael.Dt FTPD 8 1047462Scael.Os BSD 4.2 1147462Scael.Sh NAME 1247462Scael.Nm ftpd 1347462Scael.Nd 1447462ScaelInternet File Transfer Protocol server 1547462Scael.Sh SYNOPSIS 1647462Scael.Nm ftpd 1754204Sbostic.Op Fl dl 1854530Sandrew.Op Fl T Ar maxtimeout 1947462Scael.Op Fl t Ar timeout 2047462Scael.Sh DESCRIPTION 2147462Scael.Nm Ftpd 2247462Scaelis the 2347462ScaelInternet File Transfer Protocol 2447462Scaelserver process. The server uses the 2547462Scael.Tn TCP 2647462Scaelprotocol 2747462Scaeland listens at the port specified in the 2847462Scael.Dq ftp 2918965Smckusickservice specification; see 3047462Scael.Xr services 5 . 3147462Scael.Pp 3247462ScaelAvailable options: 3347462Scael.Bl -tag -width Ds 3447462Scael.It Fl d 3554530SandrewDebugging information is written to the syslog using LOG_FTP. 3647462Scael.It Fl l 3754530SandrewEach successful and failed 3847462Scael.Xr ftp 1 3954530Sandrewsession is logged using syslog with a facility of LOG_FTP. 4054530SandrewIf this option is specified twice, the retrieve (get), store (put), append, 4154530Sandrewdelete, make directory, remove directory and rename operations and 4254530Sandrewtheir filename arguments are also logged. 4347462Scael.It Fl T 4436933SkarelsA client may also request a different timeout period; 4536933Skarelsthe maximum period allowed may be set to 4647462Scael.Ar timeout 4736933Skarelsseconds with the 4847462Scael.Fl T 4936933Skarelsoption. 5036933SkarelsThe default limit is 2 hours. 5154530Sandrew.It Fl t 5254530SandrewThe inactivity timeout period is set to 5354530Sandrew.Ar timeout 5454530Sandrewseconds (the default is 15 minutes). 5547462Scael.El 5647462Scael.Pp 5754530SandrewThe file 5854530Sandrew.Pa /etc/nologin 5954530Sandrewcan be used to disable ftp access. 6054530SandrewIf the file exists, 6154530Sandrew.Nm 6254530Sandrewdisplays it and exits. 6354530SandrewIf the file 6454530Sandrew.Pa /etc/ftpwelcome 6554530Sandrewexists, 6654530Sandrew.Nm 6754530Sandrewprints it before issuing the 6854530Sandrew.Dq ready 6954530Sandrewmessage. 7054530SandrewIf the file 7154530Sandrew.Pa /etc/motd 7254530Sandrewexists, 7354530Sandrew.Nm 7466988Sbosticprints it after a successful login. 7554530Sandrew.Pp 7654530SandrewThe ftp server currently supports the following ftp requests. 7754530SandrewThe case of the requests is ignored. 7847462Scael.Bl -column "Request" -offset indent 7947462Scael.It Request Ta "Description" 8047462Scael.It ABOR Ta "abort previous command" 8147462Scael.It ACCT Ta "specify account (ignored)" 8247462Scael.It ALLO Ta "allocate storage (vacuously)" 8347462Scael.It APPE Ta "append to a file" 8447462Scael.It CDUP Ta "change to parent of current working directory" 8547462Scael.It CWD Ta "change working directory" 8647462Scael.It DELE Ta "delete a file" 8747462Scael.It HELP Ta "give help information" 8847462Scael.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA" 8947462Scael.It MKD Ta "make a directory" 9047462Scael.It MDTM Ta "show last modification time of file" 9147462Scael.It MODE Ta "specify data transfer" Em mode 9247462Scael.It NLST Ta "give name list of files in directory" 9347462Scael.It NOOP Ta "do nothing" 9447462Scael.It PASS Ta "specify password" 9547462Scael.It PASV Ta "prepare for server-to-server transfer" 9647462Scael.It PORT Ta "specify data connection port" 9747462Scael.It PWD Ta "print the current working directory" 9847462Scael.It QUIT Ta "terminate session" 9947462Scael.It REST Ta "restart incomplete transfer" 10047462Scael.It RETR Ta "retrieve a file" 10147462Scael.It RMD Ta "remove a directory" 10247462Scael.It RNFR Ta "specify rename-from file name" 10347462Scael.It RNTO Ta "specify rename-to file name" 10447462Scael.It SITE Ta "non-standard commands (see next section)" 10547462Scael.It SIZE Ta "return size of file" 10647462Scael.It STAT Ta "return status of server" 10747462Scael.It STOR Ta "store a file" 10847462Scael.It STOU Ta "store a file with a unique name" 10947462Scael.It STRU Ta "specify data transfer" Em structure 11047462Scael.It SYST Ta "show operating system type of server system" 11147462Scael.It TYPE Ta "specify data transfer" Em type 11247462Scael.It USER Ta "specify user name" 11347462Scael.It XCUP Ta "change to parent of current working directory (deprecated)" 11447462Scael.It XCWD Ta "change working directory (deprecated)" 11547462Scael.It XMKD Ta "make a directory (deprecated)" 11647462Scael.It XPWD Ta "print the current working directory (deprecated)" 11747462Scael.It XRMD Ta "remove a directory (deprecated)" 11847462Scael.El 11947462Scael.Pp 12047462ScaelThe following non-standard or 12147462Scael.Tn UNIX 12247462Scaelspecific commands are supported 12347462Scaelby the 12447462ScaelSITE request. 12547462Scael.Pp 12647462Scael.Bl -column Request -offset indent 12747462Scael.It Sy Request Ta Sy Description 12854530Sandrew.It UMASK Ta change umask, e.g. ``SITE UMASK 002'' 12954530Sandrew.It IDLE Ta set idle-timer, e.g. ``SITE IDLE 60'' 13054530Sandrew.It CHMOD Ta change mode of a file, e.g. ``SITE CHMOD 755 filename'' 13154530Sandrew.It HELP Ta give help information. 13247462Scael.El 13347462Scael.Pp 13454530SandrewThe remaining ftp requests specified in Internet RFC 959 13547462Scaelare 13618965Smckusickrecognized, but not implemented. 13754530SandrewMDTM and SIZE are not specified in RFC 959, but will appear in the 13854530Sandrewnext updated FTP RFC. 13947462Scael.Pp 14026051SminshallThe ftp server will abort an active file transfer only when the 14147462ScaelABOR 14247462Scaelcommand is preceded by a Telnet "Interrupt Process" (IP) 14326051Sminshallsignal and a Telnet "Synch" signal in the command Telnet stream, 14454530Sandrewas described in Internet RFC 959. 14547462ScaelIf a 14647462ScaelSTAT 14747462Scaelcommand is received during a data transfer, preceded by a Telnet IP 14836933Skarelsand Synch, transfer status will be returned. 14947462Scael.Pp 15047462Scael.Nm Ftpd 15147462Scaelinterprets file names according to the 15247462Scael.Dq globbing 15318965Smckusickconventions used by 15447462Scael.Xr csh 1 . 15547462ScaelThis allows users to utilize the metacharacters 15647462Scael.Dq Li \&*?[]{}~ . 15747462Scael.Pp 15847462Scael.Nm Ftpd 15918965Smckusickauthenticates users according to three rules. 16047462Scael.Pp 16147462Scael.Bl -enum -offset indent 16247462Scael.It 16354530SandrewThe login name must be in the password data base, 16447462Scael.Pa /etc/passwd , 16554530Sandrewand not have a null password. 16654530SandrewIn this case a password must be provided by the client before any 16754530Sandrewfile operations may be performed. 16847462Scael.It 16954530SandrewThe login name must not appear in the file 17047462Scael.Pa /etc/ftpusers . 17147462Scael.It 17228866SmckusickThe user must have a standard shell returned by 17347462Scael.Xr getusershell 3 . 17447462Scael.It 17547462ScaelIf the user name is 17647462Scael.Dq anonymous 17747462Scaelor 17847462Scael.Dq ftp , 17947462Scaelan 18018965Smckusickanonymous ftp account must be present in the password 18147462Scaelfile (user 18247462Scael.Dq ftp ) . 18347462ScaelIn this case the user is allowed 18454530Sandrewto log in by specifying any password (by convention an email address for 18554530Sandrewthe user should be used as the password). 18647462Scael.El 18747462Scael.Pp 18818965SmckusickIn the last case, 18947462Scael.Nm ftpd 19018965Smckusicktakes special measures to restrict the client's access privileges. 19118965SmckusickThe server performs a 19247462Scael.Xr chroot 2 19354530Sandrewto the home directory of the 19447462Scael.Dq ftp 19547462Scaeluser. 19618965SmckusickIn order that system security is not breached, it is recommended 19747462Scaelthat the 19847462Scael.Dq ftp 19954204Sbosticsubtree be constructed with care, following these rules: 20047462Scael.Bl -tag -width "~ftp/pub" -offset indent 20147462Scael.It Pa ~ftp 20247462ScaelMake the home directory owned by 20354204Sbostic.Dq root 20447462Scaeland unwritable by anyone. 205*67321Sah.ne 1i 20647462Scael.It Pa ~ftp/bin 20754204SbosticMake this directory owned by 20854204Sbostic.Dq root 20954530Sandrewand unwritable by anyone (mode 555). 21054204SbosticThe program 21147462Scael.Xr ls 1 21254204Sbosticmust be present to support the list command. 21354204SbosticThis program should be mode 111. 21447462Scael.It Pa ~ftp/etc 21554204SbosticMake this directory owned by 21654204Sbostic.Dq root 21754530Sandrewand unwritable by anyone (mode 555). 21854204SbosticThe files 21947462Scael.Xr passwd 5 22018965Smckusickand 22147462Scael.Xr group 5 22218965Smckusickmust be present for the 22347462Scael.Xr ls 22436933Skarelscommand to be able to produce owner names rather than numbers. 22536933SkarelsThe password field in 22647462Scael.Xr passwd 22754204Sbosticis not used, and should not contain real passwords. 22854530SandrewThe file 22954530Sandrew.Pa motd , 23066988Sbosticif present, will be printed after a successful login. 23136933SkarelsThese files should be mode 444. 23247462Scael.It Pa ~ftp/pub 23347462ScaelMake this directory mode 777 and owned by 23447462Scael.Dq ftp . 23554204SbosticGuests 23654204Sbosticcan then place files which are to be accessible via the anonymous 23754204Sbosticaccount in this directory. 23847462Scael.El 23954530Sandrew.Sh FILES 24054530Sandrew.Bl -tag -width /etc/ftpwelcome -compact 24154530Sandrew.It Pa /etc/ftpusers 24254530SandrewList of unwelcome/restricted users. 24354530Sandrew.It Pa /etc/ftpwelcome 24454530SandrewWelcome notice. 24554530Sandrew.It Pa /etc/motd 24654530SandrewWelcome notice after login. 24754530Sandrew.It Pa /etc/nologin 24854530SandrewDisplayed and access refused. 24954530Sandrew.El 25047462Scael.Sh SEE ALSO 25147462Scael.Xr ftp 1 , 25247462Scael.Xr getusershell 3 , 25347462Scael.Xr syslogd 8 25447462Scael.Sh BUGS 25518965SmckusickThe server must run as the super-user 25618965Smckusickto create sockets with privileged port numbers. It maintains 25718965Smckusickan effective user id of the logged in user, reverting to 25818965Smckusickthe super-user only when binding addresses to sockets. The 25918965Smckusickpossible security holes have been extensively 26018965Smckusickscrutinized, but are possibly incomplete. 26147462Scael.Sh HISTORY 26247462ScaelThe 26347462Scael.Nm 26447462Scaelcommand appeared in 26547462Scael.Bx 4.2 . 266