Configure a Device as an SFTP Server
Network Requirements
- A PC acts as an SFTP server, and Device acts as an SFTP client. The network between the server and the device is normal.
- On the SFTP server, the user name for a device to log in to the SFTP server is admin1, and the password is admin1. The file system directory of Device serves as the root directory of the SFTP server.
- The PC acts as the SFTP client to upload files to and download files from the SFTP server.
Network Topology
Figure 4-8 Networking for configuring a device as an SFTP server
Configuration Steps
Step 1: Configure the IP address of the interface so that the network between the PC and the Device is normal. (Omitted)
Step 2: On the Device, enable the SFTP server, 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
|
#On the Device, enable the SSH service (SFTP is one sub module of the SSH protocol).
Device(config)#ip ssh server |
Step 3: Use the 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...
Admin1@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 operation 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 the 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