![H3C S5120-SI Series Operation Manual Download Page 468](http://html2.mh-extra.com/html/h3c/s5120-si-series/s5120-si-series_operation-manual_3711174468.webp)
2-22
# Specify the authentication type for user
client002
as publickey, and assign the public key
Switch001
to the user.
[SwitchB] ssh user client002 service-type stelnet authentication-type publickey assign
publickey Switch001
2) Configure the SSH client
# Configure an IP address for Vlan interface 1.
<SwitchA> system-view
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] ip address 10.165.87.137 255.255.255.0
[SwitchA-Vlan-interface1] quit
# Generate a DSA key pair.
[SwitchA] public-key local create dsa
# Export the DSA public key to the file
key.pub
.
[SwitchA] public-key local export dsa ssh2 key.pub
[SwitchA] quit
After generating a key pair on a client, you need to transmit the saved public key file to the server
through FTP or TFTP and have the configuration on the server done before continuing configuration of
the client.
# Establish an SSH connection to the server (10.165.87.136).
<SwitchA> ssh2 10.165.87.136
Username: client002
Trying 10.165.87.136 ...
Press CTRL+K to abort
Connected to 10.165.87.136 ...
The Server is not authenticated. Continue? [Y/N]:y
Do you want to save the server public key? [Y/N]:n
Later, you will find that you have logged into Switch B successfully.