ssh client peer assign

Function

The ssh client peer assign command assigns a public key configured on the SSH client to the SSH server.

The undo ssh client peer assign command unbinds the public key from the SSH server.

By default, no public key is assigned to the SSH server.

Format

ssh client peer server-name assign { rsa-key | ecc-key | dsa-key | sm2-key } key-name

undo ssh client peer server-name assign { rsa-key | ecc-key | dsa-key | sm2-key }

Parameters

Parameter Description Value
server-name

Specifies the name of an SSH server.

The value is a string of 1 to 255 case-sensitive characters, spaces not supported. The string can contain only letters, digits, and underscores (_).

rsa-key

Specifies the RSA public key.

-

ecc-key

Specifies the ECC public key.

-

dsa-key

Specifies the DSA public key.

-

sm2-key

Specifies the SM2 public key.

-

key-name

Specifies the name of public key assigned to an SSH server.

The value is a string of 1 to 40 case-insensitive characters, spaces not supported.

Views

System view

Default Level

3: Management level

Task Name and Operations

Task Name Operations
ssh-client write

Usage Guidelines

  • If a device functioning as an SSH client uses the public algorithm for authentication, run the ssh client peer assign command to assign a public key to the SSH server.
  • If the first-time authentication is not enabled on the SSH client, when the SSH client logs in to the SSH server for the first time, the SSH client fails to pass the check on the public key validity and cannot log in to the server.
  • If the public key stored on the SSH client becomes invalid, run the undo ssh client peer assign command to cancel the association between the SSH server and the public key. Then, run the ssh client peer assign command to assign a new public key to the SSH server.
  • You can run the display ssh server-info command to view the binding information on the SSH client.

Example

# Assign the SM2 public key named sm2key001 to the SSH server at 10.1.1.1.
<HUAWEI> system-view
[~HUAWEI] sm2 peer-public-key sm2key001
Enter "SM2 public key" view, return system view with "peer-public-key end".
[*HUAWEI-sm2-public-key] public-key-code begin
Enter "SM2 public key" view, return system view with "peer-public-key end".
[*HUAWEI-sm2-public-key-sm2-key-code] 0474F110 F90F131B B6F6D929 9A23A41E F1AB1666
[*HUAWEI-sm2-public-key-sm2-key-code] AC4BE4EE EF2CD876 2B633F80 DD5CF42F 147A722F
[*HUAWEI-sm2-public-key-sm2-key-code] DE527F39 247F3744 C23296BE FE3BE502 EEF7D9EC
[*HUAWEI-sm2-public-key-sm2-key-code] BC28A576 7E
[*HUAWEI-sm2-public-key-sm2-key-code] public-key-code end
[*HUAWEI-sm2-public-key] peer-public-key end
[*HUAWEI] ssh client peer 10.1.1.1 assign sm2-key sm2key001
# Assign an RSA key named key01 to the SSH server.
<HUAWEI> system-view
[~HUAWEI] ssh client peer 10.1.1.1 assign rsa-key key01
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >