|
|
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.
The FTP server allows you to retrieve files, such as syslog files, from the disk file system on the router.
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:
! append ascii binary bye case cd chmod close | cr debug dir disconnect get glob hash help idle | image lcd ls macdef mdir mkdir mls mode nlist | nmap ntrans open prompt put pwd quit quote reget | reset rhelp rstatus runique send sendport site size status | sunique system tenex trace type user verbose
|
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.
To enable the FTP server, perform the following tasks in global configuration mode:
| Task | Command |
|---|---|
Enable the FTP server. | ftp-server enable |
Restrict the region where the FTP clients can read or write files. | ftp-server topdir directory |
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enable ftp-server topdir disk0:/syslogd.dir
After 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 FTProuter Connected to FTProuter.cisco.com. 220 FTProuter IOS-FTP server (version 1.00) ready. Name (FTProuter:me): aa 331 Password required for 'aa'. Password: 230 Logged in. Remote system type is Cisco. ftp> pwd 257 "disk0:/syslogd.dir/" is current directory. ftp> dir 200 PORT command successful. 150 Opening ASCII mode data connection for file list. syslogd.1 syslogd.2 syslogd.3 syslogd.4 syslogd.5 syslogd.6 syslogd.7 syslogd.8 syslogd.9 syslogd.cur 226 Transfer complete. ftp> bin 200 Type set to I. ftp> get syslogd.1 200 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.
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.
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 enableThis command has no arguments or keywords.
Disabled
Global configuration
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.
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enable ftp-server topdir disk0:/syslogd.dir
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
directory | Top-level directory path for FTP server client operations. |
Denies read and write access to any location.
Global configuration
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.
The following example enables the FTP server and limits client access to the syslogd.dir directory on disk0:
ftp-server enable ftp-server topdir disk0:/syslogd.dir
The debug ftpserver command has been added for this feature.
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 ftpserverThe following is sample output from the debug ftpserver command:
Router# debug ftpserver Mar 3 10:21:10: %FTPSERVER-6-NEWCONN: FTP Server - new connection made. -Process= "TCP/FTP Server", ipl= 0, pid= 53 Mar 3 10:21:10: FTPSRV_DEBUG:FTP Server file path: 'disk0:' Mar 3 10:21:10: FTPSRV_DEBUG:(REPLY) 220 Mar 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) 331 Mar 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) 230 Mar 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) 215 Mar 3 10:21:21: FTPSRV_DEBUG:Cisco IOS Type: L8 Version: IOS/FTP 1.00 Mar 3 10:21:21: FTPSRV_DEBUG:FTP Server Command received: 'PWD' Mar 3 10:21:35: FTPSRV_DEBUG:(REPLY) 257 Mar 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) 250 Mar 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',32 Mar 3 10:21:46: FTPSRV_DEBUG:(REPLY) 200 Mar 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) 220 Mar 3 10:23:11: FTPSRV_DEBUG:Opening ASCII mode data connection for file list. Mar 3 10:23:11: FTPSRV_DEBUG:(REPLY) 226 Mar 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) 200 Mar 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',51 Mar 3 10:23:20: FTPSRV_DEBUG:(REPLY) 200 Mar 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) 150 Mar 3 10:23:21: FTPSRV_DEBUG:Opening BINARY mode data connection for syslogd.1 (607317 bytes). Mar 3 10:23:21: FTPSRV_DEBUG:(REPLY) 226 Mar 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 FTProuter Connected to FTProuter.cisco.com. 220 FTProuter IOS-FTP server (version 1.00) ready. Name (FTProuter:me): aa 331 Password required for 'aa'. Password: 230 Logged in. Remote system type is Cisco. ftp> pwd 257 "disk0:/syslogd.dir/" is current directory. ftp> dir 200 PORT command successful. 150 Opening ASCII mode data connection for file list. syslogd.1 syslogd.2 syslogd.3 syslogd.4 syslogd.5 syslogd.6 syslogd.7 syslogd.8 syslogd.9 syslogd.cur 226 Transfer complete. ftp> bin 200 Type set to I. ftp> get syslogd.1 200 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) 550 Mar 3 10:29:14: FTPSRV_DEBUG:Access denied to 'disk0:'
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Fri Mar 5 23:27:49 PST 1999
Copyright 1989-1999©Cisco Systems Inc.