1.1 FTP
Server Configuration Commands
Syntax
display ftp-server
View
Any view
Parameters
None
Description
Use the display ftp-server command
to display the FTP server-related settings of a switch when it operates as an
FTP server, including startup status, number of users, and so on.
You can use this command to verify FTP
server-related configurations.
Related commands: ftp server enable,
ftp timeout.
Examples
# Display the FTP server-related settings
of the switch (assuming that the switch is operating as an FTP server).
<Sysname>
display ftp-server
FTP server is running
Max user number 1
User count 0
Timeout value(in minute) 30
Table 1-1 display ftp-server command output description
|
Field
|
Description
|
|
FTP server
is running
|
The FTP
server is started. If the FTP server is not started, “% FTP server has
been stopped” will be displayed, and the three fields below will not be
displayed.
|
|
Max user
number 1
|
The FTP
server can accommodate up to one user.
|
|
User count
0
|
The
current login user number is 0.
|
|
Timeout
value (in minute) 30
|
The connection
idle time is 30 minutes.
|
The H3C S5600
series Ethernet switch supports one user access at one time when it serves as
the FTP server.
Syntax
display ftp-server source-ip
View
Any view
Parameters
None
Description
Use the display ftp-server source-ip command
to display the source IP address set for an FTP server.
l
If a source interface is specified for the FTP
server, the IP address of the source interface will be displayed and the FTP
client can only use this address as the destination address to connect to the
FTP server.
l
If neither source interface nor source IP
address is specified, 0.0.0.0 will be displayed. In this case, the FTP client
can use any reachable IP address on the FTP server as the destination address
to connect to the FTP server.
To set the source IP address for an FTP server,
use the ftp-server source-interface or the ftp-server source-ip
command.
Examples
# Display
the source IP address configured for the FTP server.
<Sysname>
display ftp-server source-ip
The
source IP you specified is 192.168.0.1
Syntax
display ftp-user
View
Any view
Parameters
None
Description
Use the display ftp-user command
to display the information of the FTP users that have logged in to the switch,
including the user name, host IP address, port number, idle timeout time, and
authorized directory.
For how to create
an FTP user on an FTP server, refer to the AAA part of this manual.
Examples
# Display the information of the FTP users
that have logged in to the switch.
<Sysname> display ftp-user
UserName HostIP Port
Idle HomeDir
admin 192.168.0.152
1029 0 flash:
# If the username exceeds ten characters,
characters behind the tenth will be displayed in the second line with a
left-aligning mode. Take username username@test for example, the result
is:
<Sysname> display ftp-user
UserName HostIP
Port Idle HomeDir
administra
tor 192.168.0.152
1031 0 flash:
Table 1-2
display ftp-user command
output description
|
Field
|
Description
|
|
HostIP
|
IP address
of the FTP client
|
|
Port
|
Port used
when the FTP client logs in
|
|
Idle
|
Idle time
of the FTP client
|
|
HomeDir
|
The
initial work path configured for the FTP user, namely, the path where the
user locates after he logs in.
|
Syntax
ftp disconnect user-name
View
System view
Parameters
user-name: Name
of the user to be disconnected from the FTP server, a string of 1 to 184
characters.
Description
Use the ftp disconnect command to terminate
the connection between a specified user and the FTP server.
With an H3C S5600
series Ethernet switch acting as the FTP server, if you attempt to disconnect a
user that is uploading/downloading data to/from the FTP server, the S5600 Ethernet
switch will disconnect the user after the data transmission is completed.
Related commands: display ftp-user.
Examples
# Display the
current online FTP users.
<Sysname> display ftp-user
UserName HostIP
Port Idle HomeDir
admin 192.168.0.152 1029
0 flash:
# Disconnect the user named admin
from the FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp disconnect admin
% The user connection will be
disconnected after the data transfer finished
[Sysname]
%Apr 2 01:06:14:915 2000 Sysname FTPS/5/USEROUT:-
1 -User admin(192.168.0.152) logged out
Syntax
ftp server enable
undo ftp server
View
System view
Parameters
None
Description
Use the ftp server enable command to
enable the FTP server function of the switch.
Use the undo ftp server command to
disable the FTP server function of the switch.
By default, the FTP server function is
disabled on the H3C S5600 series switch to avoid potential security risks.
To protect unused
sockets from being attacked by malicious users, the H3C S5600 series Ethernet
switch provides the following functions:
l
TCP 21 is enabled only when you start the FTP
server.
l
TCP 21 is disabled after you shut down the FTP
server.
Related commands: display ftp-server.
Examples
# Enable the FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp server enable
% Start FTP server
Syntax
ftp timeout minutes
undo ftp timeout
View
System view
Parameters
minutes: Idle
timeout time (in minutes), in the range 1 to 35791.
Description
Use the ftp timeout command to set
the idle timeout time of an FTP client. When the idle time of the FTP client
exceeds this timeout time, the FTP server terminates the connection with the
FTP client.
Use the undo ftp timeout command to
restore the default idle timeout time.
By default, the idle timeout time is 30
minutes.
If an FTP connection between an FTP server
and an FTP client breaks down abnormally, but the FTP server cannot be aware of
this, the FTP server will keep this connection. This will occupy system
resources and affect other FTP users’ log in. You can set an idle timeout
time so that the FTP server considers an FTP connection invalid and terminates it
if no data exchange occurs on it in idle timeout time.
Examples
# Set the idle timeout time to 36 minutes.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp timeout 36
Syntax
ftp-server source-interface interface-type interface-number
undo ftp-server source-interface
View
System view
Parameters
interface-type: Type of the interface serving as the source interface of an FTP
server. The interface type can be a loopback interface or a VLAN interface.
interface-number: Number of the source interface of an FTP server.
Description
Use the ftp-server source-interface command
to specify the source interface for an FTP server. After you execute this
command, users can only use the IP address of the specified source interface as
the destination address to connect to an FTP server, which can enhance security
of the FTP server.
Use the undo ftp-server source-interface
command to cancel the source interface setting.
By default, no source interface is
specified for an FTP server, and an FTP client can use any reachable interface
address on the FTP server as the destination address to connect to the FTP
server.
Related commands: ftp-server source-ip.
Examples
# Specify VLAN-interface 1 as the source
interface of the FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp-server source-interface
Vlan-interface 1
Syntax
ftp-server source-ip ip-address
undo ftp-server source-ip
View
System view
Parameters
ip-address: The
source IP address of an FTP server.
Description
Use the ftp-server source-ip command
to specify the source IP address for an FTP server. After you execute this
command, users can only use the specified source IP address as the destination
address to connect to the FTP server. The value of argument ip-address must
be an IP address on the device where the configuration is performed. Otherwise,
a prompt appears to show the configuration fails.
Use the undo ftp-server source-ip
command to cancel the source IP address setting. By default, no source IP
address is specified for an FTP server, and an FTP client can use any reachable
address on the FTP server as the destination address to connect to an FTP
server.
Examples
# Specify 192.168.1.1 as the source IP
address of the FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp-server source-ip
192.168.1.1
1.2 FTP Client Configuration Commands
l
In the examples of this section, if a command
should be executed in FTP client view, the configuration process for entering
FTP client view will be omitted to avoid repetition. For the configuration of
the command for entering FTP client view, refer to ftp.
l
When executing the FTP client configuration commands
in this section, confirm whether the corresponding access rights are configured
on the FTP server, for example, query file lists under a working directory,
read/download the specified files, create a directory/upload a file, and
rename/delete a file on the server. For the configuration of user access
rights, refer to the FTP server software description.
Syntax
ascii
View
FTP client view
Parameters
None
Description
Use the ascii
command to specify that files be transferred in ASCII mode, which is used for
transferring text files.
By default, files are transferred in ASCII
mode.
Related commands: binary.
Examples
# Specify to transfer text files in ASCII
mode.
[ftp] ascii
200 Type set to A.
Syntax
binary
View
FTP client view
Parameters
None
Description
Use the binary command to specify
that program files be transferred in binary mode, which is used for
transferring program files.
By default, files are transferred in ASCII
mode.
Related commands: ascii.
Examples
# Specify to transfer files in binary mode.
[ftp] binary
200 Type set to I.
Syntax
bye
View
FTP client view
Parameters
None
Description
Use the bye command to terminate the
control connection and data connection with the FTP server and return to user
view.
This command has the same effect as that of
the quit command.
Examples
# Terminate the connections with the remote
FTP server and return to user view.
[ftp] bye
221 Server closing.
<Sysname>
Syntax
cd path
View
FTP client view
Parameters
path: Path of
the target directory.
Description
Use the cd command to change the
working directory on the remote FTP server.
Note that you can use this command to enter
only authorized directories.
Related commands: pwd.
Examples
# Change the working directory to flash:/temp.
[ftp] cd flash:/temp
# Display the current working directory.
[ftp] pwd
257 "flash:/temp" is
current directory.
Syntax
cdup
View
FTP client view
Parameters
None
Description
Use the cdup command to exit the
current working directory and enter the parent directory. The parent directory
must be a directory that a user is authorized to access; otherwise, the command
cannot be executed.
Related commands: cd, pwd.
Examples
# Change the working directory to flash:/temp.
[ftp] cd flash:/temp
# Change the working directory to the
parent directory.
[ftp] cdup
# Display the current directory.
[ftp] pwd
257 "flash:" is current
directory.
Syntax
close
View
FTP client view
Parameters
None
Description
Use the close command to terminate
an FTP connection without quitting FTP client view.
This command has the same effect as that of
the disconnect command.
Examples
# Terminate the FTP connection without quitting
FTP client view.
[ftp] close
221 Server closing.
[ftp]
Syntax
delete remotefile
View
FTP client view
Parameters
remotefile: Name
of the file to be deleted.
Description
Use the delete command to delete a
specified remote file.
Examples
# Delete the file temp.c.
[ftp] delete temp.c
250 DELE command successful.
Syntax
dir [
filename [ localfile ] ]
View
FTP client view
Parameters
filename: Name
of the file to be queried.
localfile:
Name of the local file where the query result is to be saved.
Description
Use the dir
command to query specified files on a remote FTP server, or to display file
information in the current directory. The output information, which includes
the name, size and creation time of files, will be saved in a local file.
If you do
not specify the filename argument, the information about all the files
in the current directory is displayed.
Caution:
You can use the dir
command to display the file-related information such as file size, creation date,
and so on. To display only the names of all the files under the current
directory, use the ls command.
Related commands: pwd.
Examples
# Display the information about all the files
in the current directory on the remote FTP server.
[ftp] dir
227 Entering Passive Mode
(192,168,0,152,4,0).
125 ASCII mode data connection
already open, transfer starting for *.
-rwxrwxrwx 1 noone nogroup
377424 Apr 26 13:05 s3r01.btm
-rwxrwxrwx 1 noone nogroup
377424 Oct 10 2006 s3r01_15.btm
-rwxrwxrwx 1 noone nogroup
2833 May 11 17:58 config.cfg
-rwxrwxrwx 1 noone nogroup
225295 Apr 26 12:21 default.diag
-rwxrwxrwx 1 noone nogroup
377424 Apr 30 16:58 switch.btm
drwxrwxrwx 1 noone
nogroup 0 Apr 28 11:41 test
-rwxrwxrwx 1 noone nogroup
2145 Apr 28 13:13 test.txt
-rwxrwxrwx 1 noone
nogroup 13 Apr 28 13:21 mytest.bak
-rwxrwxrwx 1 noone
nogroup 9 Apr 28 13:24 a.txt
-rwxrwxrwx 1 noone nogroup
142 Sep 10 2006 myopenssh
-rwxrwxrwx 1 noone nogroup
5292802 Apr 30 17:02 switch2.bin
-rwxrwxrwx 1 noone
nogroup 15 Apr 26 17:45 public
-rwxrwxrwx 1 noone
nogroup 15 Apr 26 17:56 temp.c
-rwxrwxrwx 1 noone nogroup
5286666 Oct 18 2006 switch5.bin
-rwxrwxrwx 1 noone nogroup
306 May 13 11:17 swithc001
226 Transfer complete.
FTP: 1025 byte(s) received in 0.019
second(s) 53.00K byte(s)/sec.
# Display information about file config.cfg
and save the information to file temp1.
[ftp] dir config.cfg temp1
227 Entering Passive Mode
(192,168,0,152,4,3).
125 ASCII mode data connection
already open, transfer starting for config.cfg.
.....226 Transfer complete.
FTP: 67 byte(s) received in 5.818
second(s) 11.00 byte(s)/sec.
Syntax
disconnect
View
FTP client view
Parameters
None
Description
Use the disconnect command to terminate
an FTP connection without quitting FTP client view.
This command has the same effect as that of
the close command.
Examples
# Terminate the FTP connection without quitting
FTP client view.
[ftp] disconnect
221 Server closing.
[ftp]
Syntax
display ftp source-ip
View
Any view
Parameters
None
Description
Use the display ftp source-ip command
to display the source IP address that the current device serving as an FTP
client uses every time it connects to an FTP server. If a source IP address is
specified for the FTP client, the configured source IP address will be displayed.
If neither a source IP address nor source interface is specified for the FTP
client, 0.0.0.0 will be displayed.
If no source IP address is specified for
the FTP client, the switch searches the entry with the destination as the
subnet where the FTP server resides, and uses the IP address of the outbound interface
in the entry as the source IP address.
Examples
# Display the source IP address that the
FTP client uses every time it connects to an FTP server.
<Sysname> display ftp source-ip
The source IP you specified is
192.168.0.1
Syntax
ftp [ cluster
| remote-server [ port-number ] ]
View
User view
Parameters
cluster: Connects
to the configured FTP server of a cluster. For the configuration of the FTP
server of a cluster, refer to the Cluster part of this manual.
remote-server: Host name or IP address of an FTP server, a string of 1 to 20
characters.
port-number:
Port number of the FTP server, in the range 0 to 65535. The default is 21.
Description
Use the ftp command to establish a
control connection with an FTP server. If you enter a correct username and
password, you can enter FTP client view.
Examples
# Connect to the FTP server whose IP
address is 2.2.2.2.
<Sysname>
ftp 2.2.2.2
Trying ...
Press CTRL+K to abort
Connected.
220 FTP service ready.
User(none):admin
331 Password required for admin.
Password:
230 User logged in.
[ftp]
Syntax
ftp {
cluster | remote-server } source-interface interface-type
interface-number
View
User view
Parameters
cluster: Connects
to the configured FTP server of a cluster. For the configuration of the FTP
server of a cluster, refer to the Cluster part of this manual.
remote-server: Host name or IP address of an FTP server, a string of 1 to 20
characters.
interface-type: Type of the source interface, which can be VLAN interface or
loopback interface.
interface-number: Number of the source interface.
Description
Use the ftp { cluster | remote-server
} source-interface command to configure the source IP address that
the switch uses when it connects to an FTP server. The command takes effect
only for the current connection process, and it will fail if the specified
interface does not exist.
To make the configuration take effect
forever, you can use the ftp source-interface command.
Examples
# Configure that the switch uses
VLAN-interface 1 as the source interface to connect to the FTP server whose IP
address is 192.168.8.8
<Sysname> ftp 192.168.8.8 source-interface Vlan-interface 1
Syntax
ftp {
cluster | remote-server } source-ip ip-address
View
User view
Parameters
cluster: Connects
to the configured FTP server of a cluster. For the configuration of the FTP
server of a cluster, refer to the Cluster part of this manual.
remote-server: Host name or IP address of an FTP server, a string of 1 to 20
characters.
ip-address: Source
IP address.
Description
Use the ftp { cluster | remote-server
} source-ip command to configure the source IP address that the switch
uses when it connects to an FTP server. The command takes effect only for the
current connection, and it will fail if the specified source IP address does
not exist.
To make the configuration take effect forever,
you can use the ftp source-ip command.
Examples
# Configure that the switch uses 192.168.0.1
as the source address to connect to the FTP server whose IP address is
192.168.8.8.
<Sysname> ftp 192.168.8.8
source-ip 192.168.0.1
Syntax
ftp source-interface interface-type interface-number
undo ftp source-interface
View
System view
Parameters
interface-type: Type of the source interface, which can be VLAN interface or
loopback interface.
interface-number: Number of the source interface.
Description
Use the ftp source-interface command
to specify a source interface as the source interface the switch uses every
time it connects to an FTP server, and the configuration will be saved to the configuration
file of the system.
Use the undo ftp source-interface command
to cancel the source interface setting. After you execute this command, the FTP
client system decides which interface will be used for accessing FTP servers.
By default, the switch uses the IP address
of the outbound interface in the local routing table as the source IP address
for connecting to an FTP server. The destination of the outbound interface is
the subnet where the FTP server resides.
To configure the source interface used only
for the current connection to an FTP server, use the ftp { cluster |
remote-server } source-interface command.
Examples
# Specify VLAN-interface 1 as the source interface
to be used in each connection between the switch and an FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp source-interface
Vlan-interface 1
Syntax
ftp source-ip ip-address
undo ftp source-ip
View
System view
Parameters
ip-address: IP
address that is to be specified as the source IP address.
Description
Use the ftp source-ip command to specify
the source IP address of that the switch uses every time it connects to an FTP
server, and the configuration will be saved to the configuration file of the
system. The value of argument ip-address must be an IP address on the
device where the configuration is performed. Otherwise, a prompt appears to
show the configuration fails.
Use the undo ftp source-ip command
to cancel the source IP address setting.
By default, the switch uses the IP address
of the outbound interface in the local routing table as the source IP address
for connecting to an FTP server. The destination of the outbound interface is
the subnet where the FTP server resides.
Examples
# Specify 192.168.0.1 as the source IP
address that the switch uses every time it connects to an FTP server.
<Sysname> system-view
System View: return to User View with
Ctrl+Z.
[Sysname] ftp source-ip 192.168.0.1
Syntax
get remotefile
[ localfile ]
View
FTP client view
Parameters
remotefile: Name
of a file to be downloaded.
localfile: File
name used when a file is downloaded and saved to the local device. If this
argument is not specified, the source file name is used when a file is saved
and downloaded to the local device.
Description
Use the get command to download a
remote file and save it as a local file.
Caution:
When using the get
command to download files from a remote FTP server, note to limit the length of
file path and file name within the following ranges:
l
A directory name should be no more than 91
characters.
l
A file name plus its local path name should be
no more than 127 characters.
l
A device name should be no more than 14
characters.
l
A file name plus its complete path name should
be no more than 142 characters.
Examples
# Download file temp.c.
[ftp] get temp.c
227 Entering Passive Mode (2,2,2,2,4,12).
125 ASCII mode data connection
already open, transfer starting for temp.c.
..226 Transfer complete.
FTP: 15 byte(s) received in 2.568
second(s) 0.00 byte(s)/sec.
Syntax
lcd
View
FTP client
view
Parameters
None
Description
Use the lcd command to display the local
working directory on the FTP client. If you have logged in to the FTP server,
you cannot modify the local working directory of the FTP client; to modify the local
working directory, you need to terminate the connection with the FTP server,
quit FTP client view, execute the cd command in user view, and reconnect
to the FTP server.
Examples
# Display the local working directory on
the FTP client.
[ftp] lcd
% Local directory now flash:/temp
Syntax
ls [ remotefile
[ localfile ] ]
View
FTP client view
Parameters
remotefile:
Name of the file to be queried.
localfile:
Name of the local file where the querying result is to be saved.
Description
Use the ls command to display the
information about a specified file on an FTP server.
If you do not specify the remotefile
argument, names of all the files in the current remote directory are displayed.
Caution:
The ls command only displays file names on an FTP server. To
query other file-related information, for example, file size, creation date and
so on, use the dir command.
Related commands: pwd.
Examples
# Display the names of all the files in the
current directory on the remote FTP server.
[ftp] ls
227 Entering Passive Mode (2,2,2,2,4,4).
125 ASCII mode data connection
already open, transfer starting for *.
s3r01.btm
s3r01_15.btm
config.cfg
default.diag
test
test.txt
mytest.bak
a.txt
myopenssh
public
temp.c
swithc001
226 Transfer complete.
FTP: 200 byte(s) received in 0.145
second(s) 1.00Kbyte(s)/sec.
Syntax
mkdir pathname
View
FTP client view
Parameters