Turn SSH password login on or off
PATCH /api/v2/vps/{id}/ssh-password-login
Turns root password login over SSH on or off on the running VPS. Turn it on to log in with a password after a rebuild with SSH keys. Turn it off to allow SSH keys only. true sets PasswordAuthentication yes and PermitRootLogin yes. false sets PasswordAuthentication no and PermitRootLogin prohibit-password. Root can then still log in with a key. The change runs inside the VPS through the guest agent and restarts its SSH service. The VPS must be running. The response is the setting read back afterwards, with lastOperation.verified.
Authentication: An API key with the scope write:vm. About keys and scopes
Request
Path parameters
idstringrequiredThe VPS ID (
vps_…).Body
enabledbooleanrequiredTrue to allow password login for root. False to allow SSH keys only.
Example
curl -X PATCH "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/ssh-password-login" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": true }'curl -X PATCH "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/ssh-password-login" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": false }'Responses
200 The setting after the change, read back from the VPS.
{ "available": true, "enabled": true, "reason": null, "passwordAuthentication": "yes", "permitRootLogin": "yes", "source": "effective_sshd_config", "sshKeysConfigured": true, "sshKeys": [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9wZW5BUElFeGFtcGxlS2V5TWF0ZXJpYWwxMjM0 alex@example.com" ], "actions": { "canEnable": { "allowed": false, "reason": "SSH password login is already enabled." }, "canDisable": { "allowed": true, "reason": null } }, "lastOperation": { "requestedEnabled": true, "verified": true, "message": "SSH password login enabled." }}Response fields
availablebooleanTrue when the setting was read from the running VPS.
enabledboolean or nullTrue when root can log in over SSH with a password. Null when the setting could not be read or is unclear.
reasonstring or nullWhy the setting could not be read, as a sentence you can show. Null when it was read.
passwordAuthenticationstring or nullThe
PasswordAuthentication value in the SSH server configuration, in lower case.permitRootLoginstring or nullThe
PermitRootLogin value in the SSH server configuration, in lower case.sourcestringWhere the values come from.
effective_sshd_config: the running SSH server. config_files: the configuration files. unavailable: nothing could be read. One of effective_sshd_config, config_files, unavailable, unknown.sshKeysConfiguredbooleanTrue when SSH keys are stored on the VPS service.
sshKeysarray of stringPublic SSH keys stored on the VPS service, the ones installed at setup or rebuild.
GET /api/v2/vps/{id}/ssh-access shows the keys that can log in now.actionsobjectWhat the caller can do now.
canEnableobjectWhether turning password login on makes sense now. False when it is already on or the setting cannot be read.
allowedbooleanreasonstring or nullcodestring or nullA machine-readable code for why the action is blocked.
canDisableobjectWhether turning password login off makes sense now. False when it is already off or the setting cannot be read.
allowedbooleanreasonstring or nullcodestring or nullA machine-readable code for why the action is blocked.
lastOperationobjectWhat this change did.
requestedEnabledbooleanThe
enabled value you sent.verifiedbooleanTrue when the setting read back matches what you asked for.
messagestring or nullA sentence about the result you can show.
Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is vps_not_found. |
| 409 | The change could not be made. code is vps_not_ready (setup is not finished) or upstream_failed (the command could not run or failed inside the VPS, for example because it is stopped). detail says why. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |