Table Of Contents
FTP Server
Description
The FTP Server feature configures a router to act as an FTP server. FTP clients can copy files to and from certain directories on the router. In addition, the router can perform many other standard FTP server functions.
Benefits
The FTP server allows you to retrieve files, such as syslog files, from the disk file system on the router.
Supported FTP Commands
When the router receives a request for an FTP connection, the FTP server process is started. The FTP server prompts for a username and password.
After you supply a valid username and password, you can enter various commands. Not all FTP commands are supported by this FTP server implementation. The FTP server will service the following FTP client commands:
Refer to the documentation for your FTP client for detailed information on these commands. For example, if you are using a UNIX workstation as the FTP client, enter the man ftp command for descriptions of these commands.
Configuration Tasks
To enable the FTP server, perform the following tasks in global configuration mode:
Task CommandEnable the FTP server.
ftp-server enable
Restrict the region where the FTP clients can read or write files.
ftp-server topdir directory
Configuration Examples
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enableftp-server topdir disk0:/syslogd.dirAfter these commands have been entered, you can FTP to the router. In the following example, a user connects to the router and gets the file syslogd.1. Notice that the user starts in the directory specified by the ftp-server topdir command.
FTPclient% ftp FTProuterConnected to FTProuter.cisco.com.220 FTProuter IOS-FTP server (version 1.00) ready.Name (FTProuter:me): aa331 Password required for 'aa'.Password:230 Logged in.Remote system type is Cisco.ftp> pwd257 "disk0:/syslogd.dir/" is current directory.ftp> dir200 PORT command successful.150 Opening ASCII mode data connection for file list.syslogd.1syslogd.2syslogd.3syslogd.4syslogd.5syslogd.6syslogd.7syslogd.8syslogd.9syslogd.cur226 Transfer complete.ftp> bin200 Type set to I.ftp> get syslogd.1200 PORT command successful.150 Opening BINARY mode data connection for syslogd.1 (607317 bytes).226 Transfer complete.607317 bytes received in 7.7 seconds (77 Kbytes/s)ftp>Use the debug ftpserver command to observe the process on the router.
Command Reference
This section documents new or modified commands. All other commands used with this feature are documented in the Cisco IOS Release 11.3 command references.
ftp-server enable
To enable the FTP server, use the ftp-server enable global configuration command. The no form of this command disables the FTP server.
ftp-server enable
no ftp-server enableSyntax Description
This command has no arguments or keywords.
Default
Disabled
Command Mode
Global configuration
Usage Guidelines
This command first appeared in Cisco IOS Release 11.3 AA.
When the FTP server is enabled, you can use FTP to transfer files to and from the router. For example, you can FTP performance data sets or syslog data subfiles to a network management station.
In order for clients to access files on the FTP server, you must configure both this command and the ftp-server topdir command.
Example
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enableftp-server topdir disk0:/syslogd.dirRelated Commands
ftp-server topdir
To restrict the region where FTP clients can read or write files, use the ftp-server topdir global configuration command. The no form of this command disables access completely.
ftp-server topdir directory
no ftp-server topdirSyntax Description
Default
Denies read and write access to any location.
Command Mode
Global configuration
Usage Guidelines
This command first appeared in Cisco IOS Release 11.3 AA.
You must specify a top-level directory in order for clients to use the FTP server. If you do not configure this command, clients will not be able to access any files or directories on the router.
You must also configure the ftp-server enable command to enable the FTP server on the router.
Example
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enableftp-server topdir disk0:/syslogd.dirRelated Commands
Debug Commands
The debug ftpserver command has been added for this feature.
debug ftpserver
Use the debug ftpserver EXEC command to display information about the FTP server process. The no form of this command disables debugging output.
[no] debug ftpserver
Sample Display
The following is sample output from the debug ftpserver command:
Router# debug ftpserverMar 3 10:21:10: %FTPSERVER-6-NEWCONN: FTP Server - new connection made.-Process= "TCP/FTP Server", ipl= 0, pid= 53Mar 3 10:21:10: FTPSRV_DEBUG:FTP Server file path: 'disk0:'Mar 3 10:21:10: FTPSRV_DEBUG:(REPLY) 220Mar 3 10:21:10: FTPSRV_DEBUG:FTProuter IOS-FTP server (version 1.00) ready.Mar 3 10:21:10: FTPSRV_DEBUG:FTP Server Command received: 'USER aa'Mar 3 10:21:20: FTPSRV_DEBUG:(REPLY) 331Mar 3 10:21:20: FTPSRV_DEBUG:Password required for 'aa'.Mar 3 10:21:20: FTPSRV_DEBUG:FTP Server Command received: 'PASS aa'Mar 3 10:21:21: FTPSRV_DEBUG:(REPLY) 230Mar 3 10:21:21: FTPSRV_DEBUG:Logged in.Mar 3 10:21:21: FTPSRV_DEBUG:FTP Server Command received: 'SYST'Mar 3 10:21:21: FTPSRV_DEBUG:(REPLY) 215Mar 3 10:21:21: FTPSRV_DEBUG:Cisco IOS Type: L8 Version: IOS/FTP 1.00Mar 3 10:21:21: FTPSRV_DEBUG:FTP Server Command received: 'PWD'Mar 3 10:21:35: FTPSRV_DEBUG:(REPLY) 257Mar 3 10:21:39: FTPSRV_DEBUG:FTP Server Command received: 'CWD disk0:/syslogd.d'r/'Mar 3 10:21:45: FTPSRV_DEBUG:FTP Server file path: 'disk0:/syslogd.dir'Mar 3 10:21:45: FTPSRV_DEBUG:(REPLY) 250Mar 3 10:21:45: FTPSRV_DEBUG:CWD command successful.Mar 3 10:21:45: FTPSRV_DEBUG:FTP Server Command received: 'PORT 171,69,30,20,22',32Mar 3 10:21:46: FTPSRV_DEBUG:(REPLY) 200Mar 3 10:21:46: FTPSRV_DEBUG:PORT command successful.Mar 3 10:21:46: FTPSRV_DEBUG:FTP Server Command received: 'LIST'Mar 3 10:21:47: FTPSRV_DEBUG:FTP Server file path: 'disk0:/syslogd.dir/.'Mar 3 10:21:47: FTPSRV_DEBUG:(REPLY) 220Mar 3 10:23:11: FTPSRV_DEBUG:Opening ASCII mode data connection for file list.Mar 3 10:23:11: FTPSRV_DEBUG:(REPLY) 226Mar 3 10:23:12: FTPSRV_DEBUG:Transfer complete.Mar 3 10:23:12: FTPSRV_DEBUG:FTP Server Command received: 'TYPE I'Mar 3 10:23:14: FTPSRV_DEBUG:(REPLY) 200Mar 3 10:23:14: FTPSRV_DEBUG:Type set to I.Mar 3 10:23:14: FTPSRV_DEBUG:FTP Server Command received: 'PORT 171,69,30,20,22',51Mar 3 10:23:20: FTPSRV_DEBUG:(REPLY) 200Mar 3 10:23:20: FTPSRV_DEBUG:PORT command successful.Mar 3 10:23:20: FTPSRV_DEBUG:FTP Server Command received: 'RETR syslogd.1'Mar 3 10:23:21: FTPSRV_DEBUG:FTP Server file path: 'disk0:/syslogd.dir/syslogd.1'Mar 3 10:23:21: FTPSRV_DEBUG:FTPSERVER: Input path passed Top-dir(disk0:/syslogd.dir/) test.Mar 3 10:23:21: FTPSRV_DEBUG:(REPLY) 150Mar 3 10:23:21: FTPSRV_DEBUG:Opening BINARY mode data connection for syslogd.1 (607317 bytes).Mar 3 10:23:21: FTPSRV_DEBUG:(REPLY) 226Mar 3 10:23:29: FTPSRV_DEBUG:Transfer complete.The sample output corresponds to the following FTP client session. In this example, the user connects to the FTP server, views the contents of the top-level directory, and gets a file.
FTPclient% ftp FTProuterConnected to FTProuter.cisco.com.220 FTProuter IOS-FTP server (version 1.00) ready.Name (FTProuter:me): aa331 Password required for 'aa'.Password:230 Logged in.Remote system type is Cisco.ftp> pwd257 "disk0:/syslogd.dir/" is current directory.ftp> dir200 PORT command successful.150 Opening ASCII mode data connection for file list.syslogd.1syslogd.2syslogd.3syslogd.4syslogd.5syslogd.6syslogd.7syslogd.8syslogd.9syslogd.cur226 Transfer complete.ftp> bin200 Type set to I.ftp> get syslogd.1200 PORT command successful.150 Opening BINARY mode data connection for syslogd.1 (607317 bytes).226 Transfer complete.607317 bytes received in 7.7 seconds (77 Kbytes/s)ftp>The following debug ftpserver command output indicates that no top-level directory is specified. Therefore, the client cannot access any location on the FTP server. Use the ftp-server topdir command to specify the top-level directory.
Mar 3 10:29:14: FTPSRV_DEBUG:(REPLY) 550Mar 3 10:29:14: FTPSRV_DEBUG:Access denied to 'disk0:'
