SSH Keys
Although One Time Passwords are used as the basic authentication to a new server, we strongly recommend. Use SSH keys for authentication.
Our services expose several prompts that allow you to manage your library of public ssh keys
Add an SSH key.
To add an SSH key as first thing you need to generate it locally, having generated the key simply add it to your user using the following request:
HTTP request
POST /ecs/v2/sshkeys
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDk5S4uuptEa3ylKjIVZIanNu+FYayXETb4a5R+0YfGW0ifTjDObH0bKFPi0/Val8NzbN6eSEPA0h5pH/jUlnxLIhcXd/bqZyp4NXlP8k2ls+O7Z6m24S4O6/lOrMnFxiDkx6S0YtVCkAzFgcH8mUDYWMmFQd3YFF6e8KIyB+IZKJc/vfd6QiV/2Zo8fF0z+69YDnjvsiUCvegTjg90PatG2q7WmlRZbxbcb5CJYRqi2cNUX7FejwTBvxH4G82cRf8ozyQnu60Ir2eOL0GqfEmObbbC7om8lMwqptVN6SlYfXtJovqX36xFXvUX+U+lLXv/LeysaOnGRLKp75x+oyCOXPmG7XkZPTGcaS/k/oZfWYvMwQwuBZhH+bFk3lZ5xWtSJqNXh5H+zemBW/Eu71JN4Se2Hm3bjBL2dR4HE4eef282Sk1jW3U3bdTaADF96QQaoF630r70HeaqhuUiIdM//1guqF5NhIK9AVu3pXVdKnW3XEEuEzr1RUVBrJUcgTk= user@my-pc",
"label": "my-ssh-key"
}
HTTP Response
{
"status": "ok"
}
You may receive the following errors:
Status Code | Message | Explanation |
---|---|---|
400 | An SSHKey may only have unique 'label' for 'user' | ssh key label must be unique per user |
400 | key and label params are required | both key and label fields are required |
!!! warning “Warning” In contrast to the ermes panel, key validation is not done via API and falls explicitly on the user who uses it
An invalid key would not work and could compromise the server configuration itself
Get all active SSH keys.
You can get a list of all active SSH keys using the following request:
HTTP request
GET /ecs/v2/sshkeys
HTTP Response
{
"status": "ok",
"pubkeys": [
{
"id": 0,
"label": "my-pub-key-01",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDk5S4uuptEa3ylKj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NhIK9AVu3pXVdKnW3XEEuEzr1RUVBrJUcgTk= user@my-pc-2",
"created_at": "2024-06-28T09:59:56.810000+00:00"
}
]
}
Obtaining a specific SSH key.
You can also get a specific key by using the id of it
HTTP request
GET /ecs/v2/sshkeys/{keyid}
HTTP Response
{
"status": "ok",
"pubkey": {
"id": 0,
"label": "my-pub-key-01",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDk5S4uuptEa3ylKjIVZIanNu+FYayXETb4a5R+0YfGW0ifTjDObH0bKFPi0/Val8NzbN6eSEPA0h5pH/jUlnxLIhcXd/bqZyp4NXlP8k2ls+O7Z6m24S4O6/lOrMnFxiDkx6S0YtVCkAzFgcH8mUDYWMmFQd3YFF6e8KIyB+IZKJc/vfd6QiV/2Zo8fF0z+69YDnjvsiUCvegTjg90PatG2q7WmlRZbxbcb5CJYRqi2cNUX7FejwTBvxH4G82cRf8ozyQnu60Ir2eOL0GqfEmObbbC7om8lMwqptVN6SlYfXtJovqX36xFXvUX+U+lLXv/LeysaOnGRLKp75x+oyCOXPmG7XkZPTGcaS/k/oZfWYvMwQwuBZhH+bFk3lZ5xWtSJqNXh5H+zemBW/Eu71JN4Se2Hm3bjBL2dR4HE4eef282Sk1jW3U3bdTaADF96QQaoF630r70HeaqhuUiIdM//1guqF5NhIK9AVu3pXVdKnW3XEEuEzr1RUVBrJUcgTk= user@my-pc-1",
"created_at": "2024-06-28T07:59:56.810000+00:00"
}
}
Rename an SSH key.
You can change the 'label' field of an ssh key using the following request:
HTTP request
PUT /ecs/v2/sshkeys/{keyid}
{
"label": "my-renamed-key"
}
HTTP Response
{
"status": "ok",
"pubkey": {
"id": 0,
"label": "my-renamed-key",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDk5S4uuptEa3ylKjIVZIanNu+FYayXETb4a5R+0YfGW0ifTjDObH0bKFPi0/Val8NzbN6eSEPA0h5pH/jUlnxLIhcXd/bqZyp4NXlP8k2ls+O7Z6m24S4O6/lOrMnFxiDkx6S0YtVCkAzFgcH8mUDYWMmFQd3YFF6e8KIyB+IZKJc/vfd6QiV/2Zo8fF0z+69YDnjvsiUCvegTjg90PatG2q7WmlRZbxbcb5CJYRqi2cNUX7FejwTBvxH4G82cRf8ozyQnu60Ir2eOL0GqfEmObbbC7om8lMwqptVN6SlYfXtJovqX36xFXvUX+U+lLXv/LeysaOnGRLKp75x+oyCOXPmG7XkZPTGcaS/k/oZfWYvMwQwuBZhH+bFk3lZ5xWtSJqNXh5H+zemBW/Eu71JN4Se2Hm3bjBL2dR4HE4eef282Sk1jW3U3bdTaADF96QQaoF630r70HeaqhuUiIdM//1guqF5NhIK9AVu3pXVdKnW3XEEuEzr1RUVBrJUcgTk= user@my-pc-1",
"created_at": "2024-06-28T07:59:56.810000+00:00"
}
}
Remove an SSH key.
The following request can be used to remove an ssh key:
HTTP request
DELETE /ecs/v2/sshkeys/{keyid}
HTTP Response
{
"status": "ok"
}