- Table of Contents
-
- H3C S3100 Series Ethernet Switches Command Manual (For Soliton)(V1.02)
- 00-1Cover
- 01-CLI Commands
- 02-Login Commands
- 03-Configuration File Management Commands
- 04-VLAN Commands
- 05-Management VLAN Commands
- 06-IP Address-IP Performance Commands
- 07-Voice VLAN Commands
- 08-GVRP Commands
- 09-Port Basic Configuration Commands
- 10-Link Aggregation Commands
- 11-Port Isolation Commands
- 12-Port Security-Port Binding Commands
- 13-DLDP Commands
- 14-MAC Address Table Management Commands
- 15-MSTP Commands
- 16-Multicast Commands
- 17-802.1x-System Guard Commands
- 18-AAA Commands
- 19-MAC Address Authentication Commands
- 20-ARP Commands
- 21-DHCP Commands
- 22-ACL Commands
- 23-QoS-QoS Profile Commands
- 24-Mirroring Commands
- 25-Stack-Cluster Commands
- 26-SNMP-RMON Commands
- 27-NTP Commands
- 28-SSH Commands
- 29-File System Management Commands
- 30-FTP-SFTP-TFTP Commands
- 31-Information Center Commands
- 32-System Maintenance and Debugging Commands
- 33-VLAN-VPN Commands
- 34-HWPing Commands
- 35-IPv6 Management Commands
- 36-DNS Commands
- 37-Smart Link-Monitor Link Commands
- 38-Appendix
- Related Documents
-
Title | Size | Download |
---|---|---|
30-FTP-SFTP-TFTP Commands | 147.06 KB |
Chapter 1 FTP and SFTP Configuration Commands
1.1 FTP Server Configuration Commands
1.2 FTP Client Configuration Commands
1.3 SFTP Server Configuration Commands
1.4 SFTP Client Configuration Commands
Chapter 2 TFTP Configuration Commands
2.1 TFTP Configuration Commands
Chapter 1 FTP and SFTP Configuration Commands
1.1 FTP Server Configuration Commands
1.1.1 display ftp-server
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).
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. |
& Note:
The H3C S3100 series Ethernet switch supports one user access at one time when it serves as the FTP server.
1.1.2 display ftp-user
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.
& Note:
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. |
1.1.3 ftp disconnect
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.
& Note:
With an H3C S3100 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 S3100 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
1.1.4 ftp server enable
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 S3100 series switch to avoid potential security risks.
& Note:
To protect unused sockets from being attacked by malicious users, the H3C S3100 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
1.1.5 ftp timeout
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
1.2 FTP Client Configuration Commands
& Note:
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.
1.2.1 ascii
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.
1.2.2 binary
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.
1.2.3 bye
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>
1.2.4 cd
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.
1.2.5 cdup
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.
1.2.6 close
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]
1.2.7 delete
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.
1.2.8 dir
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.
1.2.9 disconnect
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]
1.2.10 ftp
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.
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]
1.2.11 get
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.
1.2.12 lcd
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
1.2.13 ls
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.
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.
1.2.14 mkdir
Syntax
mkdir pathname
View
FTP client view
Parameters
pathname: Name of the directory to be created.
Description
Use the mkdir command to create a directory on an FTP server.
This command is available only to the FTP clients that are assigned the permission to create directories on FTP servers.
Related commands: dir, rmdir.
Examples
# Create the directory flash:/lanswitch on the FTP server.
[ftp] mkdir flash:/lanswitch
257 "flash:/ lanswitch" new directory created.
1.2.15 open
Syntax
open { ip-address | server-name } [ port ]
View
FTP client view
Parameters
ip-address: IP address of an FTP server.
server-name: Host name of the FTP server, a string of 1 to 20 characters.
port: Port number on the remote FTP server, in the range 0 to 65535. The default value is 21.
Description
Use the open command to establish a control connection with an FTP server. If you have connected to an FTP server, you cannot use the open command to connect to another server, and you need to terminate the connection with the current FTP server and then execute the open command.
Related commands: close.
Examples
# Establish a control connection with the FTP server whose IP address is 1.1.1.1 in FTP client view.
Trying ...
Press CTRL+K to abort
Connected.
220 FTP service ready.
User(none):abc
331 Password required for abc
Password:
230 User logged in.
1.2.16 passive
Syntax
passive
undo passive
View
FTP client view
Parameters
None
Description
Use the passive command to set the data transfer mode to the passive mode.
Use the undo passive command to set the data transfer mode to the active mode.
By default, the passive mode is adopted.
The differences between the passive mode and the active mode are:
l When working in the active mode, an FTP client advertises a random port Port1 to an FTP server through TCP port 21; upon receiving the advertisement, the FTP server initiates a connection with Port1 on the client for data transmission.
l When working in the passive mode, an FTP client sends a passive request to the FTP server before data transmission, the FTP server advertises a local random port Port2 to the FTP client, and the FTP client establishes a connection with Port2 using a local random port.
If an FTP client initiates a connection with an FTP server through a firewall, the firewall may block the connection request because the FTP server initiates the connection with Port1 through an external network, and thus data transmission will be affected. Therefore, you are recommended to set the data transmission mode of the FTP client to passive when accessing the FTP server through a firewall.
Examples
# Set the data transfer mode to the passive mode.
[ftp] passive
% Passive is on
1.2.17 put
Syntax
put localfile [ remotefile ]
View
FTP client view
Parameters
localfile: Name of a local file to be uploaded.
remotefile: File name used after a file is uploaded and saved on an FTP server.
Description
Use the put command to upload a local file on an FTP client to an FTP server.
If you do not specify the remotefile argument, the local file is saved on the FTP server with its original name.
Examples
# Upload the local file named temp.c to the FTP server.
227 Entering Passive Mode (2,2,2,2,4,13).
125 ASCII mode data connection already open, transfer starting for temp.c.
226 Transfer complete.
FTP: 15 byte(s) sent in 7.549 second(s) 1.00byte(s)/sec.
1.2.18 pwd
Syntax
pwd
View
FTP client view
Parameters
None
Description
Use the pwd command to display the working directory on an FTP server.
Related commands: cd, cdup, dir, ls.
Examples
# Display the working directory on the FTP server.
[ftp] pwd
257 "flash:/temp" is current directory.
1.2.19 quit
Syntax
quit
View
FTP client view
Parameters
None
Description
Use the quit command to terminate FTP control connection and FTP data connection and return to user view.
This command has the same effect as that of the bye command.
Examples
# Terminate the FTP control connection and FTP data connection and return to user view.
221 Server closing.
<Sysname>
1.2.20 remotehelp
Syntax
remotehelp [ protocol-command ]
View
FTP client view
Parameters
protocol-command: FTP protocol command.
Description
Use the remotehelp command to display the help information about an FTP protocol command.
This command works only when the FTP server provides the help information about FTP protocol commands.
Caution:
l This command is always valid when an H3C series Ethernet switch operates as the FTP server.
l If you use other FTP server software, refer to related instructions to know whether the FTP server provides help information about FTP protocol commands.
Examples
# Display the syntax of the user command.
[ftp] remotehelp user
214 Syntax: USER <sp> <username>
1.2.21 rename
Syntax
rename remote-source remote-dest
View
FTP client view
Parameters
remote-source: Name of a file on a remote host.
remote-dest: Destination file name.
Description
Use the rename command to rename a file on a remote FTP server.
If the destination file name conflicts with the name of an existing file or directory, you will fail to rename the file.
Examples
# Rename file temp.c as forever.c.
[ftp] rename temp.c forever.c
350 Enter the name to rename it to...
250 File renamed successfully
1.2.22 rmdir
Syntax
rmdir pathname
View
FTP client view
Parameters
pathname: Name of a directory on an FTP server.
Description
Use the rmdir command to remove a specified directory on an FTP server.
Note that you can only use this command to remove directories that are empty.
Examples
# Remove the directory flash:/temp1 on the FTP server. (Assume that the directory is empty.)
[ftp] rmdir flash:/temp1
200 RMD command successful.
1.2.23 user
Syntax
user username [ password ]
View
FTP client view
Parameters
username: Username used to log in to an FTP server.
password: Password used to log in to an FTP server.
Description
Use the user command to log in to an FTP server with the specified username and password.
Examples
# Log in to the FTP server using the user account with the username tom and the password 111.
[ftp] user tom 111
331 Password required for tom.
230 User logged in.verbose
1.2.24 verbose
Syntax
verbose
undo verbose
View
FTP client view
Parameters
None
Description
Use the verbose command to enable the verbose function, which displays execution information of user operations and all FTP responses.
Use the undo verbose command to disable the verbose function.
The verbose function is enabled by default.
Examples
# Download the file with name test1.cfg.
[ftp] get test1.cfg
227 Entering Passive Mode (192,168,0,3,5,239)
150 "D:\FTP\test1.cfg" file ready to send (100 bytes) in ASCII mode
....226 Transfer finished successfully.
FTP: 100 byte(s) received in 5.109 second(s) 20.00 byte(s)/sec.
# Disable the verbose function.
[ftp] undo verbose
# Download the file with name test.cfg.
[ftp] get test.cfg
......FTP: 1740 byte(s) received in 9.367 second(s) 185.00 byte(s)/sec.
The above output indicates that if the verbose function is disabled, only execution information of users’ operations is obtained from the system of the switch, while the output information beginning with three-digit numbers cannot be returned to the users.
For the description of the numbers at the beginning of FTP output information, refer to the corresponding section in RFC 959.
1.3 SFTP Server Configuration Commands
1.3.1 sftp server enable
Syntax
sftp server enable
undo sftp server
View
System view
Parameters
None
Description
Use the sftp server enable command to enable the SFTP server.
Use the undo sftp server command to disable the SFTP server.
By default, the SFTP server is disabled.
Examples
# Enable the SFTP server.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] sftp server enable
1.3.2 sftp timeout
Syntax
sftp timeout time-out-value
undo sftp timeout
View
System view
Parameters
time-out-value: Timeout time, in the range 1 to 35,791, in minutes. The default value is 10.
Description
Use the sftp timeout command to set the idle timeout time on an SFTP server.
Use the undo sftp timeout command to restore the idle timeout time to the default value.
If the idle timeout time exceeds the specified threshold, the system disconnects the SFTP user automatically.
Examples
# Set the idle timeout time to 500 minutes.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] sftp timeout 500
1.4 SFTP Client Configuration Commands
1.4.1 bye
Syntax
bye
View
SFTP client view
Parameters
None
Description
Use the bye command to terminate a connection with the remote SFTP server and return to system view.
This command has the same effect as that of the commands exit and quit.
Examples
# Terminate the connection with the remote SFTP server.
sftp-client> bye
Bye
[Sysname]
1.4.2 cd
Syntax
cd [ remote-path ]
View
SFTP client view
Parameters
remote-path: Path of the target directory on the remote server.
Description
Use the cd command to change the working path on the remote SFTP server. If no remote path is specified, this command displays the current working path.
& Note:
l Use the cd .. command to return to the parent directory.
l Use the cd / command to return to the root directory.
Examples
# Change the working path to new1.
sftp-client>cd new1
Received status: Success
Current Directory is:
/new1
sftp-client>
1.4.3 cdup
Syntax
cdup
View
SFTP client view
Parameters
None
Description
Use the cdup command to change the working path on the remote SFTP server and return to the parent directory.
Examples
# Change the working path and return to the parent directory.
sftp-client>cdup
Received status: Success
Current Directory is:
/
1.4.4 delete
Syntax
delete remote-file&<1-10>
View
SFTP client view
Parameters
remote-file&<1-10>: Name of a file on the server. &<1-10> indicates that up to ten file names can be input. These file names should be separated by spaces.
Description
Use the delete command to delete a specified file from the remote SFTP server.
This command has the same effect as that of the remove command.
Examples
# Delete the file named test.txt on the server.
sftp-client> delete test.txt
The following files will be deleted:
/test.txt
Are you sure to delete it?(Y/N):y
This operation may take a long time.Please wait...
Received status: Success
File successfully Removed
1.4.5 dir
Syntax
dir [ -a | -l ] [ remote-path ]
View
SFTP client view
Parameters
-a: Displays the file and folder names in a specified directory.
-l: Displays the details about files and folders in a specified directory in a list.
remote-path: Name of the path where the file and folders to be queried reside.
Description
Use the dir command to query a specified directory on the remote SFTP server.
If -a or -l is not specified, the command displays details about the files and folders in the specified directory in a list.
If no remote path is specified, this command displays the files in the current working directory.
This command has the same effect as that of the Is command.
Examples
# Display the files in the current directory.
sftp-client> dir
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey1
-rwxrwxrwx 1 noone nogroup 225 Sep 28 08:28 pub1
drwxrwxrwx 1 noone nogroup 0 Sep 28 08:24 new1
drwxrwxrwx 1 noone nogroup 0 Sep 28 08:18 new2
-rwxrwxrwx 1 noone nogroup 225 Sep 28 08:30 pub2
Received status: End of file
Received status: Success
1.4.6 exit
Syntax
exit
View
SFTP client view
Parameters
None
Description
Use the exit command to terminate a connection with the remote SFTP server and return to system view.
This command has the same effect as that of the commands bye and quit.
Examples
# Terminate a connection with the remote SFTP server.
sftp-client> exit
Bye
[Sysname]
1.4.7 get
Syntax
get remote-file [ local-file ]
View
SFTP client view
Parameters
remote-file: Name of a file on the remote SFTP server.
local-file: Name of a local file.
Description
Use the get command to download a file from the remote server.
By default, the remote file name is used for the file saved locally if no local file name is specified.
Examples
# Download the file tt.bak and save it with the name tt.txt.
sftp-client>get tt.bak tt.txt....
This operation may take a long time, please wait...
Remote file:tt.bak ---> Local file: tt.txt..
Received status: End of file
Received status: Success
Downloading file successfully ended
1.4.8 help
Syntax
help [ all |command ]
View
SFTP client view
Parameters
all: Displays all the command names.
command: Command name.
Description
Use the help command to display the help information about SFTP client commands.
If no command is specified, this command displays all the command names.
Examples
# View the help information about the get command.
sftp-client> help get
get remote-path [local-path] Download file.Default local-path is the same
with remote-path
1.4.9 ls
Syntax
ls [ -a | -l ] [ remote-path ]
View
SFTP client view
Parameters
-a: Displays the file and folder names in a specified directory.
-l: Displays the details about files and folders in a specified directory in a list.
remote-path: Name of the path where the files and folders to be queried reside.
Description
Use the Is command to display files in a specified directory on the remote SFTP server.
If -a or -l is not specified, the command displays details about the files and folders in the specified directory in a list.
If no remote path is specified, this command displays the files in the current working directory.
This command has the same effect as that of the dir command.
Examples
# Display the files in the current directory.
sftp-client> ls
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey1
-rwxrwxrwx 1 noone nogroup 225 Sep 28 08:28 pub1
drwxrwxrwx 1 noone nogroup 0 Sep 28 08:24 new1
drwxrwxrwx 1 noone nogroup 0 Sep 28 08:18 new2
-rwxrwxrwx 1 noone nogroup 225 Sep 28 08:30 pub2
Received status: End of file
Received status: Success
1.4.10 mkdir
Syntax
mkdir remote-path
View
SFTP client view
Parameters
remote-path: Name of a directory on the remote SFTP server.
Description
Use the mkdir command to create a directory on the remote SFTP server.
Examples
# Create a directory named hj on the remote SFTP server.
sftp-client>mkdir hj
Received status: Success
New directory created
1.4.11 put
Syntax
put local-file [ remote-file ]
View
SFTP client view
Parameters
local-file: Name of a local file.
remote-file: Name of a file on the remote SFTP server.
Description
Use the put command to upload a local file to the remote SFTP server.
By default, the local file name is used for the remote file if no remote file name is specified.
Examples
# Upload the file named config.cfg to the remote SFTP server and save it as 1.txt.
sftp-client>put config.cfg 1.txt
This operation may take a long time, please wait...
Local file:config.cfg ---> Remote file: /1.txt
Received status: Success
Uploading file successfully ended
1.4.12 pwd
Syntax
pwd
View
SFTP client view
Parameters
None
Description
Use the pwd command to display the working directory on the remote SFTP server.
Examples
# Display the working directory on the remote SFTP server.
sftp-client> pwd
/
1.4.13 quit
Syntax
quit
View
SFTP client view
Parameters
None
Description
Use the quit command to terminate a connection with the remote SFTP server and return to system view.
This command has the same effect as that of the commands bye and exit.
Examples
# Terminate a connection with the remote SFTP server.
sftp-client> quit
Bye
[Sysname]
1.4.14 remove
Syntax
remove remote-file&<1-10>
View
SFTP client view
Parameters
remote-file&<1-10>: Name of a file on the server. &<1-10> indicates that up to ten file names can be input. These file names should be separated by spaces.
Description
Use the remove command to delete a specified file from the remote SFTP server.
This command has the same effect as that of the delete command.
Examples
# Delete the file named temp.c from the server.
sftp-client> remove temp.c
The followed File will be deleted:
/temp.c
Are you sure to delete it?(Y/N):y
This operation may take a long time.Please wait...
Received status: Success
File successfully Removed
1.4.15 rename
Syntax
rename oldname newname
View
SFTP client view
Parameters
oldname: Old file name.
newname: New file name.
Description
Use the rename command to rename a specified file on the remote SFTP server.
Examples
# Change the file name temp.bat to temp.txt.
sftp-client> rename temp.bat temp.txt
File successfully renamed
1.4.16 rmdir
Syntax
rmdir remote-path&<1-10>
View
SFTP client view
Parameters
remote-path&<1-10>: Name of a directory on the remote SFTP server. &<1-10> indicates that up to ten file names can be input. These file names should be separated by spaces.
Description
Use the rmdir command to remove a specified directory from the remote SFTP server.
Examples
# Remove the directory hello on the SFTP server.
sftp-client>rmdir hello
The followed directory will be deleted
/hello
Are you sure to remove it?(Y/N):y
This operation may take a long time.Please wait...
Received status: Success
Directory successfully removed
1.4.17 sftp
Syntax
sftp { host-ip | host-name } [ port-num ] [identity-key { dsa | rsa } | prefer_kex { dh_group1 | dh_exchange_group } | prefer_ctos_cipher { des | aes128 } | prefer_stoc_cipher { des | aes128 } | prefer_ctos_hmac { sha1 | sha1_96 | md5 | md5_96 } | prefer_stoc_hmac { sha1 | sha1_96 | md5 | md5_96 } ] *
View
System view
Parameters
host-ip: IP address of the server.
host-name: Host name of the server, a string of 1 to 20 characters.
port-num: Port number of the server, in the range of 0 to 65535. The default value is 22.
identity-key: The public key algorithm used by the publickey authentication. rsa is the default.
l dsa: The public key algorithm is DSA.
l rsa: The public key algorithm is RSA.
prefer_kex: Specifies a preferred key exchange algorithm. You can select either of the two algorithms.
l dh_group1: Key exchange algorithm diffie-hellman-group1-sha1. It is the default key exchange algorithm.
l dh_exchange_group: Key exchange algorithm diffie-hellman-group-exchange-sha1.
prefer_ctos_cipher: Preferred client-to-server encryption algorithm. The default algorithm is aes128.
prefer_stoc_cipher: Preferred server-to-client encryption algorithm. The default algorithm is aes128.
l des: des_cbc encryption algorithm.
l aes128: aes_128 encryption algorithm.
prefer_ctos_hmac: Preferred client-to-server HMAC algorithm. The default algorithm is sha1_96.
prefer_stoc_hmac: Preferred server-to-client HMAC algorithm. The default algorithm is sha1_96.
l sha1: HMAC algorithm hmac-sha1.
l sha1_96: HMAC algorithm hmac-sha1-96.
l md5: HMAC algorithm hmac-md5.
l md5_96: HMAC algorithm hmac-md5-96.
Description
Use the sftp command to establish a connection with the remote SFTP server and enter SFTP client view.
If you specify to authenticate a client through public key on the server, the client needs to read the local private key when logging in to the SFTP server. Since both RSA and DSA are available for public key authentication, you need to use the identity-key key word to specify the algorithms to get correct local private key; otherwise you will fail to log in.
Examples
# Connect the SFTP server with the IP address 10.1.1.2. Use the default encryption algorithm.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname]sftp 10.1.1.2
Input Username: kk
Trying 10.1.1.2...
Press CTRL+K to abort
Connected to 10.1.1.2 ...
The Server is not authenticated. Do you continue access it?(Y/N):y
Do you want to save the server's public key?(Y/N):y
Enter password:
sftp-client>
Chapter 2 TFTP Configuration Commands
2.1 TFTP Configuration Commands
& Note:
When accessing a TFTP server configured with an IPv6 address, use the tftp ipv6 command. For details, refer to the IPv6 Management part in this manual.
2.1.1 tftp { ascii | binary }
Syntax
tftp { ascii | binary }
View
System view
Parameters
ascii: Transfers data in ASCII mode, which is used for transferring text files.
binary: Transfers data in binary mode, which is used for transferring program files.
Description
Use the tftp { ascii | binary } command to set the TFTP data transfer mode.
By default, the binary mode is adopted.
Examples
# Specify to adopt the ASCII mode.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] tftp ascii
TFTP transfer mode changed to ASCII.
2.1.2 tftp get
Syntax
tftp tftp-server get source-file [ dest-file ]
View
User view
Parameters
tftp-server: IP address or the host name of a TFTP server, a string of 1 to 20 characters. If the switch belongs to a cluster, the value cluster means to connect to the TFTP server of the cluster. For the configuration of the TFTP server of a cluster, refer to the Cluster part in this manual.
source-file: Name of the file to be downloaded from the TFTP server.
dest-file: File name used when a file is downloaded and saved to the switch.
Description
Use the tftp get command to download a file from a TFTP server, and save it to the local storage device.
Different from the FTP function, the working directory of a TFTP server cannot be changed or specified on a TFTP client. To enter another working directory, you need to modify the working directory on the TFTP server and relog in.
The H3C S3100 series switch supports the TFTP file size negotiation function, namely, before downloading a file, the switch requests the size of the file to be downloaded to the TFTP server, thus to ensure whether there is enough space on the Flash for file downloading. If the TFTP server also supports the function, when the file size is too large, the switch can know this in advance and stops the download operation to save network resources; if the TFTP server does not support the function, the switch can only download the file to its memory, and delete the file if it finds the file is too large when writing the file to the Flash.
Related commands: tftp put.
Examples
# Download file abc.txt from the TFTP server whose IP address is 1.1.1.1 and save it as efg.txt (suppose free space of the flash memory is sufficient).
<Sysname> tftp 1.1.1.1 get abc.txt efg.txt
File will be transferred in binary mode.
Downloading file from remote tftp server, please wait......
TFTP: 35 bytes received in 0 second(s).
File downloaded successfully.
# Download file temp.txt from the TFTP server (1.1.1.1) and save it as test1.txt (suppose that free space of the Flash is insufficient and the TFTP server does not support file size negotiation).
<Sysname> tftp 1.1.1.1 get temp.txt test1.txt
File will be transferred in binary mode.
Downloading file from remote tftp server, please wait......
Not enough space; Writing to device failed; Downloaded data will be deleted.............
Deleting file successful.
# Download file temp.txt from the TFTP server (1.1.1.1) and save it as test2.txt (suppose that free space of the Flash is insufficient and the TFTP server supports file size negotiation).
<Sysname> tftp 1.1.1.1 get temp.txt test2.txt
File will be transferred in binary mode.
Downloading file from remote tftp server, please wait......
Not enough space; Quit writing to device; Created file will be deleted.............
Deleting file successful.
2.1.3 tftp put
Syntax
tftp tftp-server put source-file [ dest-file ]
View
User view
Parameters
tftp-server: IP address or the host name of a TFTP server, a string of 1 to 20 characters. If the switch belongs to a cluster, the value cluster means to connect to the TFTP server of the cluster. For the configuration of the TFTP server of a cluster, refer to the Cluster part in this manual.
source-file: Name of the file to be uploaded to the TFTP server.
dest-file: File name used when a file is uploaded and saved to a TFTP server.
Description
Use the tftp put command to upload a file to a specified directory on a TFTP server.
When uploading files to a TFTP server, you can only select the files under the current working directory of the device. To upload files in another directory, use the cd command to change to the specified directory in user view before executing the tftp put command. For the execution of the cd command, refer to the File System Management part in this manual.
Related commands: tftp get.
Examples
# Upload file config.cfg to the TFTP server whose IP address is 1.1.1.1 and save it as temp.cfg.
<Sysname> tftp 1.1.1.1 put config.cfg temp.cfg
File will be transferred in binary mode.
Copying file to remote tftp server. Please wait... /
TFTP: 962 bytes sent in 0 second(s).
File uploaded successfully.
2.1.4 tftp-server acl
Syntax
tftp-server acl acl-number
undo tftp-server acl
View
System view
Parameters
acl-number: Basic ACL number, in the range 2000 to 2999.
Description
Use the tftp-server acl command to specify the ACL adopted for the connection between a TFTP client and a TFTP server.
Use the undo tftp-server acl command to cancel all ACLs adopted.
Examples
# Specify to adopt ACL 2000 on the TFTP client.
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] tftp-server acl 2000