335
# Generate a DSA key pair.
[RouterB] public-key local create dsa
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Press CTRL+C to abort.
Input the bits of the modulus[default = 1024]:
Generating Keys...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++
# Enable the SSH server.
[RouterB] ssh server enable
# Enable the SFTP server.
[RouterB] sftp server enable
# Configure an IP address for interface GigabitEthernet 1/0/1, which the client uses as the destination
for SSH connection.
[RouterB] interface GigabitEthernet 1/0/1
[RouterB-GigabitEthernet1/0/1] ip address 192.168.0.1 255.255.255.0
[RouterB-GigabitEthernet1/0/1] quit
# Set the authentication mode of the user interfaces to AAA.
[RouterB] user-interface vty 0 4
[RouterB-ui-vty0-4] authentication-mode scheme
# Enable the user interfaces to support SSH.
[RouterB-ui-vty0-4] protocol inbound ssh
[RouterB-ui-vty0-4] quit
# Import the peer public key from the file
pubkey
.
[RouterB] public-key peer Router001 import sshkey pubkey
# For user
client001
, set the service type as SFTP, authentication method as
publickey
, public key as
Router001
, and working folder as
cfa0:/
.
[RouterB] ssh user client001 service-type sftp authentication-type publickey assign
publickey Router001 work-directory cfa0:/
3.
Establish a connection between the SFTP client and the SFTP server.
# Establish a connection to the remote SFTP server, and enter SFTP client view.
<RouterA> sftp 192.168.0.1 identity-key rsa
Input Username: client001
Trying 192.168.0.1 ...
Press CTRL+K to abort
Connected to 192.168.0.1 ...
The Server is not authenticated. Continue? [Y/N]:y
Do you want to save the server public key? [Y/N]:n
sftp-client>