Create SSH key pair

This function generates an SSH key pair.

SecurityBasicAuth
Request
query Parameters
abort_on_existing_key
integer
Default: 1

Whether to abort the function if the user already has a key with the same name.

  • 1 — Abort.
  • 0 — Continue.
Enum: 0 1
Example: abort_on_existing_key=1
algorithm
string

The key's encryption algorithm. The parameter defaults to the system's default algorithm.

Enum: "rsa2" "dsa"
Example: algorithm=dsa
bits
integer

The key's bits:

  • 1024 — The DSA algorithm's default value.
  • 2048
  • 4096 — The RSA algorithm's default value.
Enum: 1024 2048 4096
Example: bits=2048
comment
string
Default: ""

A comment.

Example: comment=NoComment
name
string
Default: "id_rsa"

The key's filename.

This parameter defaults to id_rsa if the algorithm is RSA, and id_dsa if the algorithm is DSA.

Example: name=KeyFile
passphrase
string
Default: ""

The key's secure passphrase.

Example: passphrase=123456luggage
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/generatesshkeypair
Request samples
whmapi1 --output=jsonpretty \
  generatesshkeypair
Response samples
application/json
{
  • "data": {
    • "fingerprint": null,
    • "name": "KeyFile"
    },
  • "metadata": {
    • "command": "generatesshkeypair",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}