Configure a Device as SFTP Server
Network Requirements
- Device acts as the SFTP server, PC acts as the SFTP client, and the network between the client and the server is connected.
- On the SFTP server Device, set the user name to admin1 and the password to admin1; the file system directory of Device acts as the root directory of the SFTP server.
- PC acts as the SFTP client to upload and download the file with the SFTP server Device.
Network Topology
![Network topology for configuring the device as the SFTP server](/storage/images/Document/Maipu/system-login/topology-sftp-server.jpg)
Figure 2‑10 Network topology for configuring the device as the SFTP server
Configuration Steps
Step 1: Create VLANs, and add ports to the required VLANs.(Omitted)
Step 2: Configure the IP address of the interface, making the network between PC and Device be connected (omitted).
Step 3: On Device, enable the SFTP service and configure the authorized user name and password.
#On the SFTP server Device, configure the authorized user name and password.
Device#configure terminal
Device(config)#local-user admin1 class manager
Device(config-user-manager-admin1)#service-type ssh
Device(config-user-manager-admin1)#password 0 admin1
Device(config-user-manager-admin1)#exit
|
Enable the SSH service on Device (SFTP is one sub module of the SSH protocol.
Device(config)#ip ssh server |
Step 4: Use PC as the SFTP client to upload and download one file to the SFTP server Device.
#The following takes the Linux system as an example to describe the related process.
#Input the correct IP address and user name, password to log into the SFTP server.
[root@aas ~]# sftp admin1@2.1.1.1
Connecting to 2.1.1.1...
admin@2.1.1.1's password:
sftp>
|
#Get the startup file in the file system of the SFTP server Device.
sftp> get startup startup
Fetching /flash/startup to startup
/flash/startup 100%
13KB 12.9KB/s 00:00
|
#After copying the file, you can find the related file in the operated directory.
sftp> ls
sp8-g-6.6.7(74)-dbg.pck sp8-g-6.6.7(76)-dbg.pck startup tech
test_pc
sftp>
|
#Upload the file in PC to the file system of the SFTP server Device.
sftp> put sp8-g-6.6.7(76)-dbg.pck sp8-g-6.6.7(76)-dbg.pck
Uploading sp8-g-6.6.7(76)-dbg.pck to /flash/ sp8-g-6.6.7(76)-dbg.pck
sp8-g-6.6.7(76)-dbg.pck
100% 11424KB 16.0KB/s 00:00
|
#After uploading the file, you can find the corresponding file in the file system of Device.
Device(config-fs)#dir
size date time name
------------ ------ ------ --------
2048 JUN-30-2015 16:35:50 tech
10229 JUN-12-2015 14:31:22 history 101890 JUN-30-2015 17:46:40 logging 39755 JUN-30-2015 16:33:56 startup 740574 MAY-27-2014 18:55:14 web-Spl-1.1.243.rom 2048 JUN-27-2015 16:26:10 snmp
11698172 JUN-30-2015 10:36:18 sp8-g-6.6.7(76)-dbg.pck