Document navigation

SSH Key

Overview

SSH Key: SSH key is a login authentication method of Linux VM instances. An SSH public key and an SSH private key work together as a pair.

Characteristics

SSH key has the following characteristics:
  • Security: SSH key applies the asymmetric encryption mechanism, which help reduces the risk of brute force attacks.
  • Convenience: With the SSH key, you can access the target VM instance quickly without entering the password.
  • Restriction: You can use SSH keys to access Linux VM instances as root users.

Quick Start

You can quickly get started with SSH key by following these steps:
  1. Create a SSH key pair and keep the private key well.
  2. Attach the SSH public key to a VM instance.
  3. Upload the SSH private key to the access terminate, and run ssh -i ${private_key.pem} ${UserName}@${IpAddress} to log in to the VM instance.
Note: In the login command, ${private_key.pem} refers to the private key file path, ${UserName} refers to the username, and ${IpAddress} refers to the IP address of the VM instance to be logged in to. For example,
ssh -i private_key.pem root@172.20.20.149
For more information, see Log in to VM Instance with SSH Key.

Inventory

SshKeyPair Inventory

Name Description Optional Optional Value Starting Version
uuid The UUID. For more information, see Resource Property. 4.7.21
name The name. For more information, see Resource Property. 4.7.21
description The description. For more information, see Resource Property. 4.7.21
groupBy Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. 4.7.21
SystemTag The system tags. For more information, see CreateSystemTag. 4.7.21
tagUuid The tag UUID. 4.7.21
userTag The user tags. For more information, see CreateUserTag. 4.7.21
publicKey 4.7.21
createDate The creation date. For more information, see Resource Property. 4.7.21
lastOpDate The last operation date. For more information, see Resource Property. 4.7.21
userTags The user tags. For more information, see CreateUserTag. 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. 4.7.21
Sample
{
    "inventories": [
        {
            "createDate": "Sep 25, 2023 1:29:04 PM",
            "lastOpDate": "Sep 25, 2023 1:29:04 PM",
            "name": "miyao",
            "publicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfn8GoxuWrqBixsiySD6oqka1W2XsE9RrP4auc0qK9SeKfKsZ+gPa8iXUu1kG7
LqGhp26TgriaYSKJpnWeV3VU0OgUYOv6RVF9YGCXiUfQd6EyN/qjR+KbF6A4HV0J6JBhmy/7YWv45zNsC92pLFubInhjvE2WqWeWYAg+laUir/a4wh6eKDZR1wgtDX
KUJ3CZCfCDXgaO0ML1QYSBihzJeP9b06ttyzwF7XqHYjDYulmjX0JUnIb3p5M4erT0rNN+w5hHdg1i1LfzIRtNqcK91DJ06rKUNzcgmyJuL7HOxxgpNo5fGXaqY4QA
GdRyoR7MTpChLpBN94TuyEV8f7sN ",
            "uuid": "86f08f4c06c84b3898829d73a47cb009"
        }
    ],
    "success": true
}

Operations

GenerateSshKeyPair

Generate SshKeyPair. For example,
GenerateSshKeyPair name=ssh-key-pair

Parameters

Name Description Optional Valid Value Starting Version
name The resource name. 4.7.21
description The detailed description of the resource. Yes 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

CreateSshKeyPair

Create SshKeyPair, For example,
CreateSshKeyPair name=ssh-key-pair publicKey=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWNMQriGc2KPLlKROR4kg9nAgzHv0Wa8wBNcOkqhH50Pfshv4f6r+y3e4mHW6pcyiw65Vv6qUrgnvhBzkBrWaOwXMVwnVj3SAWoop9k2yhRMYOW9cC5JReNPH3I1GvlSmGwXt3h2PW1O3o+pvWpvQM7tw+vWydhX5otvj9yXaepfRSrQV4iMWBvHnDMlgY1MpWQzYx7W9OZp0uT2tBTAzhK47o2Vx81Z8ImHNFk0OkFSTBo4NFQlu4LPDRBnpuWwh/tfy2BelsvoBYZ6CgXaky0cEtC1nfn9X4aQXXlbo5UKh9vS/Xj4J8UL+EKBJ0bMA36WzaaIeX/KuYXVVt1Al5

Parameters

Name Description Optional Valid Value Starting Version
name The resource name. 4.7.21
publicKey 4.7.21
description The detailed description of the resource. Yes 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

DeleteSshKeyPair

Deletes SshKeyPair, For example,
DeleteSshKeyPair uuid=86f08f4c06c84b3898829d73a47cb009

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

QuerySshKeyPair

Queries a snapshot group. For example,
QuerySshKeyPair uuid=86f08f4c06c84b3898829d73a47cb009

Primitive Fields of Query

See Query SshKeyPair

UpdateSshKeyPair

Update SshKeyPair. For example,
UpdateSshKeyPair uuid=cbd93a2598fc424aa4f890ec3fb670d5

Parameters

Name Description Optional Valid Value Starting Version
uuid The resource UUID. 4.7.21
name The resource name. Yes 4.7.21
description The detailed description of the resource. Yes 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

AttachSshKeyPairToVmInstance

Attach SshKeyPair to a VM instance. For example,
AttachSshKeyPairToVmInstance vmInstanceUuid=e6251b82663b4ad5a5501f02dcfc60ab sshKeyPairUuid=cbd93a2598fc424aa4f890ec3fb670d5

Parameters

Name Description Optional Valid Value Starting Version
vmInstanceUuid The VM instance UUID. 4.7.21
sshKeyPairUuid url 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

DetachSshKeyPairFromVmInstance

Detach SshKeyPair from a VM instance. For example,
DetachSshKeyPairFromVmInstance vmInstanceUuid=e6251b82663b4ad5a5501f02dcfc60ab sshKeyPairUuid=cbd93a2598fc424aa4f890ec3fb670d5

Parameters

Name Description Optional Valid Value Starting Version
vmInstanceUuid The VM instance UUID. 4.7.21
sshKeyPairUuid url 4.7.21
userTags The user tags. For more information, see CreateUserTag. Yes 4.7.21
systemTags The system tags. For more information, see CreateSystemTag. Yes 4.7.21

Tags

You can create a user tag on a snapshot group by using resourceType=VolumeSnapshotVO. For example,
CreateUserTag resourceType=VolumeSnapshotVO tag=golden-ResourceStack
resourceUuid=27260a1dfa93453087d67c69dc78805c
CLI Command Manual | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center