- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
03-FTP and TFTP configuration commands | 194.74 KB |
FTP server configuration commands
FTP client configuration commands
display ftp client configuration
display tftp client configuration
FTP server configuration commands
display ftp-server
Use display ftp-server to display the FTP server configuration and status information.
Syntax
display ftp-server [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
3: Manage level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
After configuring FTP server parameters, you can verify them with this command.
Examples
# Display the FTP server configuration and status information.
<Sysname> display ftp-server
FTP server is running
Max user number: 1
User count: 1
Timeout value(in minute): 30
Put Method: fast
Table 1 Command output
Field |
Description |
Max user number |
Maximum number of concurrent login users. |
User count |
Number of the current login users. |
Timeout value (in minute) |
Allowed idle time of an FTP connection. If no packet exchange occurs between the FTP server and client during this period, the FTP connection is broken. |
Put Method |
File update method of the FTP server: · fast. · normal. |
· ftp server enable
· ftp timeout
· ftp update
display ftp-user
Use display ftp-user to display online FTP user information.
Syntax
display ftp-user [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
3: Manage level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Examples
# Display online FTP user information.
<Sysname> display ftp-user
UserName HostIP Port Idle HomeDir
ftp 192.168.1.54 1190 0 flash:
administra
tor 192.168.0.152 1031 0 flash:
// The output shows two online FTP users, where the username of the second user is administrator. This username exceeds 10 characters and the excessive characters are displayed in the next line and right justified.
Table 2 Command output
Field |
Description |
UserName |
Name of the user. |
HostIP |
IP address of the user. |
Port |
Port number of the user. |
Idle |
Duration time of the current FTP connection in minutes. |
HomeDir |
Authorized directory for the user. |
free ftp user
Use free ftp user to release the FTP connection established by a specific user.
Syntax
free ftp user username
Views
User view
Default command level
3: Manage level
Parameters
username: Username. To view online FTP user information, use the display ftp-user command.
Usage guidelines
This command immediately releases the FTP connection established by the specified user, even if the user is transmitting a file.
Examples
# Release the FTP connection established by user ftpuser.
<Sysname> free ftp user ftpuser
Are you sure to free FTP user ftpuser? [Y/N]:y
<Sysname>
ftp server acl
Use ftp server acl to use an ACL to control FTP client access to the FTP server.
Use undo ftp server acl to restore the default.
Syntax
ftp server acl acl-number
undo ftp server acl
Default
No ACL is used to control FTP client access to the FTP server.
Views
System view
Default command level
3: Manage level
Parameters
acl-number: Basic ACL number, in the range of 2000 to 2999.
Usage guidelines
You can use this command to permit only FTP requests from specific FTP clients.
This configuration only takes effect for FTP connections to be established; it does not impact existing FTP connections.
If you execute the command multiple times, the last setting takes effect.
Examples
# Use ACL 2001 to allow only the client 1.1.1.1 to access the FTP server.
<Sysname> system-view
[Sysname] acl number 2001
[Sysname-acl-basic-2001] rule 0 permit source 1.1.1.1 0
[Sysname-acl-basic-2001] rule 1 deny source any
[Sysname-acl-basic-2001] quit
[Sysname] ftp server acl 2001
ftp server dscp
Use ftp server dscp to set the DSCP value for IP to use for outgoing FTP packets on an FTP server.
Use undo ftp server dscp to restore the default.
Syntax
ftp server dscp dscp-value
undo ftp server dscp
Default
IP uses the DSCP value 0 for outgoing FTP packets on a FTP server.
Views
System view
Default command level
2: System level
Parameters
dscp-value: Specifies a DSCP value in the range of 0 to 63.
Examples
# Set the DSCP value for IP to use for outgoing FTP packets to 30 on an FTP server.
<Sysname> system-view
[Sysname] ftp server dscp 30
ftp server enable
Use ftp server enable to enable the FTP server.
Use undo ftp server to disable the FTP server.
Syntax
ftp server enable
undo ftp server
Default
The FTP server is disabled.
Views
System view
Default command level
3: Manage level
Examples
# Enable the FTP server.
<Sysname> system-view
[Sysname] ftp server enable
[Sysname]
ftp timeout
Use ftp timeout to set the idle-timeout timer for FTP connections.
Use undo ftp timeout to restore the default.
Syntax
ftp timeout minute
undo ftp timeout
Default
The FTP idle-timeout timer is 30 minutes.
Views
System view
Default command level
3: Manage level
Parameters
minute: Idle-timeout time, in the range of 1 to 35791 minutes.
Usage guidelines
If no packet is exchanged on an FTP connection within the idle-timeout time, the FTP connection is broken.
Examples
# Set the idle-timeout timer to 36 minutes.
<Sysname> system-view
[Sysname] ftp timeout 36
[Sysname]
ftp update
Use ftp update to set the file update mode that the FTP server uses while receiving data.
Use undo ftp update to restore the default.
Syntax
ftp update { fast | normal }
undo ftp update
Default
The file update mode is normal.
Views
System view
Default command level
3: Manage level
Parameters
fast: Fast update. In this mode, the FTP server writes the complete file to the memory before writing it to the storage medium.
normal: Normal update. In this mode, the FTP server writes the data of a file from the memory to the storage medium multiple times, with up to 4096 bytes per time.
Examples
# Set the FTP update mode to normal.
<Sysname> system-view
[Sysname] ftp update normal
[Sysname]
FTP client configuration commands
Before executing FTP client configuration commands, make sure proper authorization configurations have been made for users on the FTP server. Authorized operations include view the files under the current directory, read/download the specified files, create directory/upload files, and rename/remove files.
The prompt information in the following examples varies with FTP servers.
ascii
Use ascii to set the file transfer mode to ASCII.
Syntax
ascii
Default
The file transfer mode is ASCII.
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
The carriage return characters vary with operating systems. For example, H3C and Windows use characters /r/n, and Linux uses characters /n. To transfer files between two systems that use different carriage return characters, determine FTP transfer mode according to the file type.
FTP transfers files in either of the following modes:
· Binary mode—Transfers image files or pictures.
· ASCII mode—Transfers text files.
Examples
# Set the file transfer mode to ASCII.
[ftp] ascii
200 Type set to A.
[ftp]
binary
binary
Use binary to set the file transfer mode to binary mode, or "flow mode".
Syntax
binary
Default
The transfer mode is ASCII mode.
Views
FTP client view
Default command level
3: Manage level
Examples
# Set the file transfer mode to binary.
[ftp] binary
200 Type set to I.
[ftp]
ascii
bye
Use bye to disconnect from the remote FTP server and return to user view.
Syntax
bye
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
If no connection is established between the device and the remote FTP server, use this command to return to user view.
Examples
# Terminate the connection with the remote FTP server and return to user view.
[ftp] bye
221 Server closing.
<Sysname>
Related commands
· close
· disconnect
· quit
cd
Use cd to change the current working directory to another directory on the FTP server.
Syntax
cd { directory | .. | / }
Views
FTP client view
Default command level
3: Manage level
Parameters
directory: Name of the target directory, in the format of [drive:][/]path, where drive represents the storage medium name, typically Flash or CF. If the target directory does not exist, the cd command does not change the current working directory. If no drive information is provided, the argument represents a folder or subfolder in the current directory. For more information about the drive and path arguments, see Fundamentals Configuration Guide.
..: Returns to the upper directory. The execution of the cd .. command equals the execution of the cdup command. If the current working directory is the FTP root directory, the cd .. command does not change the current working directory. This argument does not support command line online help.
/: Returns to the FTP root directory. The keyword does not support command line online help.
Examples
# Change the working directory to the subdirectory logfile of the current directory.
[ftp] cd logfile
250 CWD command successful.
# Change the working directory to the subdirectory folder of the FTP root directory.
[ftp] cd /folder
250 CWD command successful.
# Change the working directory to the upper directory of the current directory.
[ftp] cd ..
250 CWD command successful.
# Change the working directory to the FTP root directory.
[ftp] cd /
250 CWD command successful.
[ftp]
pwd
cdup
Use cdup to enter the upper directory of the FTP server.
Syntax
cdup
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
This command does not change the working directory if the current directory is the FTP root directory.
Examples
# Change the working directory to the upper directory.
[ftp] pwd
257 "/ftp/subdir" is current directory.
[ftp] cdup
200 CDUP command successful.
[ftp] pwd
257 "/ftp" is current directory.
[ftp]
· cd
· pwd
close
Use close to terminate the connection to the FTP server, but remain in FTP client view.
Syntax
close
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
This command is equal to the disconnect command.
Examples
# Terminate the connection to the FTP server and remain in FTP client view.
[ftp] close
221 Server closing.
[ftp]
debugging
Use debugging to enable FTP client debugging.
Use undo debugging to disable FTP client debugging.
Syntax
debugging
undo debugging
Default
FTP client debugging is disabled.
Views
FTP client view
Default command level
1: Monitor level
Examples
# The device serves as the FTP client. Enable FTP client debugging and use the active mode to download file sample.file from the current directory of the FTP server.
<Sysname> terminal monitor
<Sysname> terminal debugging
<Sysname> ftp 192.168.1.46
Trying 192.168.1.46 ...
Press CTRL+K to abort
Connected to 192.168.1.46.
220 FTP service ready.
User(192.168.1.46:(none)):ftp
331 Password required for ftp.
Password:
230 User logged in.
[ftp]undo passive
FTP: passive is off
[ftp] debugging
FTP: debugging switch is on
[ftp] get sample.file
---> PORT 192,168,1,44,4,21
200 Port command okay.
The parsed reply is 200
---> RETR sample.file
150 Opening ASCII mode data connection for /sample.file.
The parsed reply is 150
FTPC: File transfer started with the signal light turned on.
FTPC: File transfer completed with the signal light turned off.
.226 Transfer complete.
FTP: 3304 byte(s) received in 4.889 second(s), 675.00 byte(s)/sec.
[ftp]
Table 3 Command output
Field |
Description |
---> PORT 192,168,1,44,4,21 |
FTP command. 192,168,1,44 specifies the destination IP address, and 4,21 is used to calculate the data port number by using the formula 4*256+21. |
The parsed reply is |
Received reply code, defined in RFC 959. |
---> RETR |
Download the file. |
FTPC: File transfer started with the signal light turned on. |
File transfer starts, and the signal light is turned on. |
FTPC: File transfer completed with the signal light turned off. |
File transfer is completed, and the signal light is turned off. |
delete
Use delete to permanently delete a specified file on the remote FTP server.
Syntax
delete remotefile
Views
FTP client view
Default command level
3: Manage level
Parameters
remotefile: File name.
Usage guidelines
To perform this operation, you must have delete permission on the FTP server.
Examples
# Delete file temp.c.
[ftp] delete temp.c
250 DELE command successful.
[ftp]
dir
Use dir to view detailed information about the files and subdirectories under the current directory on the FTP server.
Use dir remotefile to display detailed information about a specific file or directory on the FTP server.
Use dir remotefile localfile to save detailed information about a specific file or directory on the FTP server to a local file.
Syntax
dir [ remotefile [ localfile ] ]
Views
FTP client view
Default command level
3: Manage level
Parameters
remotefile: Name of the file or directory on the FTP server.
localfile: Name of the local file used to save the displayed information.
Usage guidelines
The Is command displays only the names of files and directories. The dir command displays more information about the files and directories, such as the size and the creation date.
Examples
# View detailed information about the files and subdirectories under the current directory on the FTP server.
[ftp] dir
227 Entering Passive Mode (192,168,1,46,5,68).
125 ASCII mode data connection already open, transfer starting for /*.
drwxrwxrwx 1 noone nogroup 0 Aug 08 2013 logfile
-rwxrwxrwx 1 noone nogroup 20471748 May 11 2013 test.bin
-rwxrwxrwx 1 noone nogroup 4001 Dec 08 2013 config.cfg
-rwxrwxrwx 1 noone nogroup 3608 Jun 13 2013 startup.cfg
drwxrwxrwx 1 noone nogroup 0 Dec 03 2013 test
-rwxrwxrwx 1 noone nogroup 299 Oct 15 2013 key.pub
226 Transfer complete.
FTP: 394 byte(s) received in 0.189 second(s), 2.00K byte(s)/sec.
[ftp]
# Save detailed information about file router.cfg to aa.txt.
[ftp] dir router.cfg aa.txt
227 Entering Passive Mode (192,168,1,50,17,158).
125 ASCII mode data connection already open, transfer starting for /router.cfg.
....226 Transfer complete.
FTP: 67 byte(s) received in 4.600 second(s), 14.00 byte(s)/sec.
# View the content of file aa.txt.
[ftp] quit
<Sysname> more aa.txt
-rwxrwxrwx 1 noone nogroup 3077 Jun 20 15:34 router.cfg
disconnect
Use disconnect to disconnect from the FTP server but remain in FTP client view.
Syntax
disconnect
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
This command is equal to the close command.
Examples
# Disconnect from the FTP server but remain in FTP client view.
[ftp] disconnect
221 Server closing.
[ftp]
display ftp client configuration
Use display ftp client configuration to display the source IP address configuration of the FTP client.
Syntax
display ftp client configuration [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
If the specified source IP address is active, this command displays the source IP address. If the specified source interface is active, this command displays the source interface.
Examples
# Display the source IP address configuration of the FTP client.
<Sysname> display ftp client configuration
The source IP address is 192.168.0.123
ftp client source
ftp
Use ftp to log in to an FTP server and enter FTP client view.
Syntax
ftp [ server-address [ service-port ] [ source { interface interface-type interface-number | ip source-ip-address } ] ]
Views
User view
Default command level
3: Manage level
Parameters
server-address: IP address or host name of the FTP server, a string of 1 to 20 characters.
service-port: TCP port number of the FTP server, in the range of 0 to 65535. The default value is 21.
source { interface interface-type interface-number | ip source-ip-address }: Specifies a source address for outgoing FTP packets.
· interface interface-type interface-number: Specifies a source interface. The primary IP address of this interface will be used as the source address for outgoing FTP packets. If no primary IP address is configured on the source interface, the connection cannot be established.
· ip source-ip-address: Specifies a source IP address. This source address must be the one of the device's IP addresses.
Usage guidelines
This command applies to only IPv4 networks.
If no parameters are specified, this command enters the FTP client view without logging in to the FTP server.
If the server parameters are specified, you are prompted to enter the username and password for accessing the FTP server.
Examples
# Log in to FTP server 192.168.0.211, specifying the source IP address for outgoing FTP packets as 192.168.0.212.
<Sysname1> ftp 192.168.0.211 source ip 192.168.0.212
Trying 192.168.0.211 ...
Press CTRL+K to abort
Connected to 192.168.0.211.
220 FTP Server ready.
User(192.168.0.211:(none)):abc
331 Password required for abc
Password:
230 User logged in.
[ftp]
ftp client dscp
Use ftp client dscp to set the DSCP value for IPv4 to use for outgoing FTP packets on an FTP client.
Use undo ftp client dscp to restore the default.
Syntax
ftp client dscp dscp-value
undo ftp client dscp
Default
IPv4 uses the DSCP value 0 for outgoing FTP packets on an FTP client.
Views
System view
Default command level
2: System level
Parameters
dscp-value: Specifies a DSCP value in the range of 0 to 63.
Examples
# Set the DSCP value for IPv4 to use for outgoing FTP packets to 30 on an FTP client.
<Sysname> system-view
[Sysname] ftp client dscp 30
ftp client source
Use ftp client source to specify a source IP address for outgoing FTP packets.
Use undo ftp client source to restore the default.
Syntax
ftp client source { interface interface-type interface-number | ip source-ip-address }
undo ftp client source
Default
The primary IP address of the output interface is used as the source IP address.
Views
System view
Default command level
2: System level
Parameters
interface interface-type interface-number: Specifies a source interface for outgoing FTP packets. The primary IP address of this interface will be used as the source address for outgoing FTP packets. If no primary IP address is configured on the source interface, the connection cannot be established.
ip source-ip-address: Specifies a source IP address for outgoing FTP packets. This IP addresses must be one of the IP addresses of the device.
Usage guidelines
You can use the ftp client source command to specify a source IP address or source interface for the FTP packets sent by the device. If a source interface (typically a loopback interface) is specified, its primary IP address is used as the source IP address for the FTP packets sent by the device. The source interface setting and the source IP address setting overwrite each other.
|
IMPORTANT: To avoid FTP connection failures, when you specify a source interface for FTP packets, make sure the interface has a primary IP address. |
The ftp client source command setting applies to all FTP sessions. When you set up an FTP session using the ftp command, you can also specify a different source IP address for the FTP session.
Examples
# Specify 2.2.2.2 as the source IP address for outgoing FTP packets.
<Sysname> system-view
[Sysname] ftp client source ip 2.2.2.2
# Use the primary IP address of interface GigabitEthernet 1/0/1 as the source IP address for outgoing FTP packets.
<Sysname> system-view
[Sysname] ftp client source interface gigabitethernet 1/0/1
[Sysname]
Related commands
display ftp client configuration
get
Use get to download a file from the FTP server.
Syntax
get remotefile [ localfile ]
Views
FTP client view
Default command level
3: Manage level
Parameters
remotefile: Name of the file to be downloaded.
localfile: Name for the downloaded file. If this argument is not specified, the original name is used.
Examples
# Download file testcfg.cfg to the root directory of the storage medium, and save it as newest.cfg.
[ftp] get testcfg.cfg newest.cfg
227 Entering Passive Mode (192,168,1,46,4,47).
125 ASCII mode data connection already open, transfer starting for /testcfg.cfg.
..226 Transfer complete.
FTP: 3608 byte(s) received in 2.050 second(s), 1.00K byte(s)/sec.
lcd
Use lcd to display the local working directory of the FTP client.
Syntax
lcd
Views
FTP client view
Default command level
3: Manage level
Examples
# Display the local working directory.
[ftp] lcd
FTP: Local directory now flash:/clienttemp.
The output shows that the working directory of the FTP client before execution of the ftp command is flash:/clienttemp.
ls
Use ls to list files and subdirectories in the current directory of the FTP server.
Use ls remotefile to list files under a specific subdirectory or verify the existence of a file in the current directory of the FTP server .
Use ls remotefile localfile to save the name of file or the list of files under a specific subdirectory to a local file.
Syntax
ls [ remotefile [ localfile ] ]
Views
FTP client view
Default command level
3: Manage level
Parameters
remotefile: Name of the file or directory on the FTP server.
localfile: Name of the local file used to save the displayed information.
Usage guidelines
The ls command displays only the names of files and directories on the FTP server. The dir command displays more information about the files and directories, such as the size and the creation date.
Examples
# List all files and subdirectories in the current directory of the FTP server.
[ftp] ls
227 Entering Passive Mode (192,168,1,50,17,165).
125 ASCII mode data connection already open, transfer starting for /*.
router.cfg
logfile
mainar.bin
arbasicbtm.bin
ftp
test
bb.cfg
testcfg.cfg
226 Transfer complete.
FTP: 87 byte(s) received in 0.132 second(s) 659.00 byte(s)/sec.
# List all files in subdirectory logfile.
[ftp] ls logfile
227 Entering Passive Mode (192,168,1,50,10,49).
125 ASCII mode data connection already open, transfer starting for /logfile/*.
logfile.log
a.cfg
226 Transfer complete.
FTP: 20 byte(s) received in 0.075 second(s), 266.00 byte(s)/sec. .
# Save the result to file aa.txt.
[ftp] ls logfile aa.txt
227 Entering Passive Mode (192,168,1,50,4,3).
125 ASCII mode data connection already open, transfer starting for /logfile/*.
....226 Transfer complete.
FTP: 20 byte(s) received in 3.962 second(s), 5.00 byte(s)/sec.
# View the content of file aa.txt.
[ftp] quit
221 Server closing.
<Sysname> more aa.txt
logfile.log
a.cfg
<Sysname>
mkdir
Use mkdir to create a subdirectory in the current directory on the FTP server.
Syntax
mkdir directory
Views
FTP client view
Default command level
3: Manage level
Parameters
directory: Name of the directory to be created.
Usage guidelines
You must have permissions to perform this operation on the FTP server.
Examples
# Create subdirectory mytest in the current directory of the FTP server.
[ftp] mkdir mytest
257 "/mytest" new directory created.
[ftp]
open
Use open to log in to an IPv4 FTP server under FTP client view.
Syntax
open server-address [ service-port ]
Views
FTP client view
Default command level
3: Manage level
Parameters
server-address: IP address or host name of an FTP server.
service-port: Port number of the FTP server, in the range of 0 to 65535. The default value is 21.
Usage guidelines
At login, you must enter the correct username and password.
If you have logged in to one IPv4 FTP server, you cannot use the open command to log in to another server. To do so, disconnect from the current server first.
Examples
# In FTP client view, log in to the FTP server at 192.168.1.50.
<Sysname> ftp
[ftp] open 192.168.1.50
Trying 192.168.1.50 ...
Press CTRL+K to abort
Connected to 192.168.1.50.
220 FTP service ready.
User(192.168.1.50:(none)):aa
331 Password required for aa.
Password:
230 User logged in.
[ftp]
close
passive
Use passive to set the FTP operation mode to passive.
Use undo passive to set the FTP operation mode to active.
Syntax
passive
undo passive
Default
The FTP operation mode is passive.
Views
FTP client view
Default command level
3: Manage level
Usage guidelines
FTP can operate in either of the following modes:
· Active mode—The FTP server initiates the TCP connection.
· Passive mode—The FTP client initiates the TCP connection.
Examples
# Set the FTP operation mode to passive.
[ftp] passive
FTP: passive is on
[ftp]
put
Use put to upload a file on the client to the FTP server.
Syntax
put localfile [ remotefile ]
Default
If no name is assigned to the file to be saved on the FTP server, the name of the source file is used.
Views
FTP client view
Default command level
3: Manage level
Parameters
localfile: Name of the local file to be uploaded.
remotefile: File name used after a file is uploaded and saved on the FTP server.
Usage guidelines
When a file is uploaded, it is saved in the user's authorized directory, which can be set with the authorization-attribute command on the remote server.
Examples
# Upload source file vrpcfg.cfg from the device to the FTP server and save it as ftpclient.cfg.
[ftp] put vrpcfg.cfg ftpclient.cfg
227 Entering Passive Mode (192,168,1,46,4,50).
125 ASCII mode data connection already open, transfer starting for /ftpclient.cfg.
226 Transfer complete.
FTP: 1366 byte(s) sent in 0.064 second(s), 21.00Kbyte(s)/sec.
pwd
Use pwd to display the current directory on the FTP server.
Syntax
pwd
Views
FTP client view
Default command level
3: Manage level
Examples
# Display the current directory on the FTP server.
[ftp] cd servertemp
[ftp] pwd
257 "/servertemp" is current directory.
The output shows you are in the servertemp folder under the FTP root directory.
quit
Use quit to disconnect the FTP client from the FTP server and exit to user view.
Syntax
quit
Views
FTP client view
Default command level
3: Manage level
Examples
# Disconnect from the FTP server and exit to user view.
[ftp] quit
221 Server closing.
<Sysname>
remotehelp
Use remotehelp to display FTP commands supported by the FTP server.
Use remotehelp protocol-command to display the syntax of an FTP command supported by the FTP server.
Syntax
remotehelp [ protocol-command ]
Views
FTP client view
Default command level
3: Manage level
Parameters
protocol-command: Specifies an FTP command.
Examples
# Display FTP commands supported by the FTP server.
[ftp] remotehelp
214-Here is a list of available ftp commands
Those with '*' are not yet implemented.
USER PASS ACCT* CWD CDUP SMNT* QUIT REIN*
PORT PASV TYPE STRU* MODE* RETR STOR STOU*
APPE* ALLO* REST* RNFR* RNTO* ABOR* DELE RMD
MKD PWD LIST NLST SITE* SYST STAT* HELP
NOOP* XCUP XCWD XMKD XPWD XRMD
214 Direct comments to H3C company.
# Display the syntax of the user command.
[ftp] remotehelp user
214 Syntax: USER <sp> <username>.
[ftp]
Table 4 Command output
Field |
Description |
USER |
Username. |
PASS |
Password. |
CWD |
Change the current working directory. |
CDUP |
Change to parent directory. |
SMNT* |
File structure setting. |
QUIT |
Quit. |
REIN* |
Reinitialization. |
PORT |
Port number. |
PASV |
Passive mode. |
TYPE |
Request type. |
STRU* |
File structure. |
MODE* |
Transmission mode. |
RETR |
Download a file. |
STOR |
Upload a file. |
STOU* |
Store unique. |
APPE* |
Appended file. |
ALLO* |
Allocation space. |
REST* |
Restart. |
RNFR* |
Rename the source. |
RNTO* |
Rename the destination. |
ABOR* |
Abort the transmission. |
DELE |
Delete a file. |
RMD |
Delete a folder. |
MKD |
Create a folder. |
PWD |
Print working directory. |
LIST |
List files. |
NLST |
List file description. |
SITE* |
Locate a parameter. |
SYST |
Display system parameters. |
STAT* |
State. |
HELP |
Help. |
NOOP* |
No operation. |
XCUP |
Extension command, the same meaning as CDUP. |
XCWD |
Extension command, the same meaning as CWD. |
XMKD |
Extension command, the same meaning as MKD. |
XPWD |
Extension command, the same meaning as PWD. |
XRMD |
Extension command, the same meaning as RMD. |
Syntax: USER <sp> <username>. |
Syntax of the user command: user (keyword) + space + username. |
rmdir
Use rmdir to remove a directory from the FTP server.
Syntax
rmdir directory
Views
FTP client view
Default command level
3: Manage level
Parameters
directory: Directory name on the FTP server.
Usage guidelines
Only authorized users are allowed to use this command.
Delete all files and subdirectories under a directory before you delete the directory. For how to delete files, see the delete command.
When you execute the rmdir command, the files in the remote recycle bin in the directory will be automatically deleted.
Examples
# Delete the temp1 directory from the FTP root directory.
[ftp] rmdir /temp1
200 RMD command successful.
[ftp]
user
Use user to switch to another user account.
Syntax
user username [ password ]
Views
FTP client view
Default command level
3: Manage level
Parameters
username: Login username.
password: Login password.
Usage guidelines
The user account to switch to must have been configured on the FTP server.
You can enter the password in either of the following ways after entering the username:
· Press the space bar and then enter the password in the same line.
· Press Enter and then enter the password when the prompt "Password:" appears.
Examples
# After logging in to an FTP server as user ftp1, use the username ftp2 to re-log in to the server (suppose the username ftp2 and password 123123123123 have been configured on the FTP server):
· Method 1
[ftp] user ftp2
331 Password required for ftp2.
Password:
230 User logged in.
[ftp]
· Method 2
[ftp] user ftp2 123123123123
331 Password required for ftp.
230 User logged in.
[ftp]
verbose
Use verbose to enable displaying detailed prompt information received from the server.
Use undo verbose to disable displaying detailed prompt information.
Syntax
verbose
undo verbose
Default
The display of detailed prompt information is enabled.
Views
FTP client view
Default command level
3: Manage level
Examples
# Enable displaying detailed prompt information.
[ftp] verbose
FTP: verbose is on
# Disable displaying detailed prompt information and perform a Get operation.
[ftp] undo verbose
FTP: verbose is off
[ftp] get startup.cfg bb.cfg
FTP: 3608 byte(s) received in 0.052 second(s), 69.00K byte(s)/sec.
[ftp]
# Enable displaying detailed prompt information and perform a Get operation.
[ftp] verbose
FTP: verbose is on
[ftp] get startup.cfg aa.cfg
227 Entering Passive Mode (192,168,1,46,5,85).
125 ASCII mode data connection already open, transfer starting for /startup.cfg.
226 Transfer complete.
FTP: 3608 byte(s) received in 0.193 second(s), 18.00K byte(s)/sec.
display tftp client configuration
Use display tftp client configuration to display the source IP address configuration of the TFTP client.
Syntax
display tftp client configuration [ | { begin | exclude | include } regular-expression ]
Views
Any view
Default command level
1: Monitor level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Usage guidelines
The display tftp client configuration command displays the source IP address configuration of the TFTP client. If the specified source IP address is active, this command displays the source IP address. If the specified source interface is active, this command displays the source interface.
Examples
# Display the source IP address configuration of the TFTP client.
<Sysname> display tftp client configuration
The source IP address is 192.168.0.123
Related commands
tftp client source
tftp-server acl
Use tftp-server acl to use an ACL to control the device' access to a specific TFTP server.
Use undo tftp-server acl to restore the default.
Syntax
tftp-server acl acl-number
undo tftp-server acl
Default
No ACL is used to control the device's access to a TFTP server.
Views
System view
Default command level
3: Manage level
Parameters
acl-number: Number of a basic ACL, in the range of 2000 to 2999.
Usage guidelines
You can use an ACL to deny or permit the device's access to a specific TFTP server.
For more information about ACL, see ACL and QoS Configuration Guide.
Examples
# Allow the device to access only the TFTP server at 1.1.1.1.
<Sysname> system-view
[Sysname] acl number 2000
[Sysname-acl-basic-2000] rule permit source 1.1.1.1 0
[Sysname-acl-basic-2000] quit
[Sysname] tftp-server acl 2000
tftp
Use tftp to download a file from the TFTP server to the local device or upload a local file to the TFTP server in an IPv4 network.
Syntax
tftp server-address { get | put | sget } source-filename [ destination-filename ] [ source { interface interface-type interface-number | ip source-ip-address } ]
Views
User view
Default command level
3: Manage level
Parameters
server-address: IP address or host name of a TFTP server.
get: Downloads a file in normal mode.
put: Uploads a file.
sget: Downloads a file in secure mode.
source-filename: Source file name.
destination-filename: Destination file name. If this argument is not specified, the file uses the source file name and is saved in the directory where the user performed the TFTP operation.
source: Configures parameters for source address binding.
interface interface-type interface-number: Specifies the source interface by its type and number. The primary IP address configured on the source interface is the source IP address of the packets sent by TFTP. If no primary IP address is configured on the source interface, the transmission fails.
ip source-ip-address: Specifies the source IP address for the current TFTP client to transmit packets. This source address must be an IP address that has been configured on the device.
Examples
# To upgrade the device, download the newest.bin file from the TFTP root directory of the TFTP server at 192.168.1.26 and save it to the Flash root directory.
<Sysname> tftp 192.168.1.26 get newest.bin startup.bin
.
File will be transferred in binary mode
Downloading file from remote TFTP server, please wait..................
TFTP: 2737556 bytes received in 13 second(s)
File downloaded successfully.
tftp client dscp
Use tftp client dscp to set the DSCP value for IPv4 to use for outgoing TFTP packets on a TFTP client.
Use undo tftp client dscp to restore the default.
Syntax
tftp client dscp dscp-value
undo tftp client dscp
Default
IPv4 uses the DSCP value 0 for outgoing TFTP packets on a TFTP client.
Views
System view
Default command level
2: System level
Parameters
dscp-value: Specifies a DSCP value in the range of 0 to 63.
Examples
# Set the DSCP value for IPv4 to use for outgoing TFTP packets to 30 on a TFTP client.
<Sysname> system-view
[Sysname] tftp client dscp 30
tftp client source
Use tftp client source to specify a source IP address for outgoing TFTP packets.
Use undo tftp client source to restore the default.
Syntax
tftp client source { interface interface-type interface-number | ip source-ip-address }
undo tftp client source
Default
The primary IP address of the output interface is used as the source IP address for outgoing TFTP packets.
Views
System view
Default command level
2: System level
Parameters
interface interface-type interface-number: Specifies a source interface for outgoing TFTP packets.
ip source-ip-address: Specifies a source IP address for outgoing TFTP packets. This IP address must be one of the IP addresses configured on the device.
Usage guidelines
You can use the tftp client source command to specify a source IP address or source interface for the TFTP packets sent by the device. If a source interface (typically a loopback interface) is specified, its primary IP address is used as the source IP address for the TFTP packets. The source interface setting and the source IP address setting overwrite each other.
|
IMPORTANT: To avoid TFTP connection failures, when you specify a source interface for TFTP packets, make sure the interface has been assigned a primary IP address. |
The tftp client source command setting applies to all TFTP sessions. When you set up a TFTP session with the tftp command, you can also specify a different source IP address for the TFTP session.
Examples
# Specify 2.2.2.2 as the source IP address for outgoing TFTP packets.
<Sysname> system-view
[Sysname] tftp client source ip 2.2.2.2
# Use the primary IP address of interface GigabitEthernet 1/0/1 as the source IP address for outgoing TFTP packets.
<Sysname> system-view
[Sysname] tftp client source interface gigabitethernet 1/0/1
[Sysname]
Related commands
display tftp client configuration