SSH access and SSH keys through the AI assistant
How the assistant gets direct SSH access, how it manages the keys in your account and on the server, and what safeguards are in place.
On this page
An AI assistant connected through MCP (https://api.app.blackbox.md/mcp) can, at your request, get direct SSH access to your servers and manage SSH keys in your account and on the server. You give it access with an API token created in “Contul meu” (My account) → “Token-uri API” (API tokens) (blackbox.md/account/api-tokens). You can also manage the same keys yourself: on the “Chei SSH” (SSH keys) page in your account, and on the server card in “My Servers”, in the app.blackbox.md panel.
Available to: the holder of the blackbox.md account, through an API token with the permissions below. The server tools work on the servers you ordered and on a company's servers for which BLACKBOX has given you management rights. They do not work on servers marked “Managed” in the panel (view only); for changes to those servers, write to us.
The blackbox.md website is available in Romanian and Russian; this article quotes the Romanian labels with their English meaning.
Tools and required permissions
| Tool | What it does | Permission | Limit |
|---|---|---|---|
get_server_ssh_access |
issues the agent key and the SSH connection details | servers:credentials |
10 in 5 minutes |
list_ssh_keys |
shows the keys saved in your account | ssh_keys:read |
30 per minute |
add_ssh_key |
saves a public key in your account | ssh_keys:write |
10 per hour |
delete_ssh_key |
deletes a key from your account | ssh_keys:write |
20 per hour |
add_server_ssh_key |
installs a key on the server | servers:credentials |
10 in 5 minutes |
list_server_ssh_keys |
shows the keys installed on the server | servers:credentials |
30 per minute |
remove_server_ssh_key |
removes a key from the server | servers:credentials |
10 in 5 minutes |
set_server_password_auth |
turns SSH password login on or off | servers:credentials |
5 in 5 minutes |
- On the tokens page, these permissions are called “Vizualizează parolele/accesul serverelor” (View server passwords/access) (
servers:credentials), “Citește lista cheilor mele SSH” (Read the list of my SSH keys) (ssh_keys:read) and “Adaugă și șterge cheile mele SSH” (Add and delete my SSH keys) (ssh_keys:write). Tools that the token has no permission for do not appear in the assistant's list. Details: Token permissions (scopes). - The limits are shared by all the tokens in your account and are separate from the panel's limits. All MCP tools together accept at most 120 calls per minute.
Direct SSH access for the assistant
get_server_ssh_access gives the assistant its own SSH key for a server: the agent key. BLACKBOX generates an Ed25519 key with the comment blackbox-agent-…, adds it to /root/.ssh/authorized_keys, and returns it together with the connection details.
Ask the assistant, for example: “Give me SSH access to the server
SERVER_IP, I want to copy files with rsync.”The assistant calls
get_server_ssh_access. The AI client may ask you to approve the call.The response contains:
Field Content host,port,usernamethe server's IP address, the SSH port and the rootuserprivate_keythe private part of the key, in OpenSSH format, not protected by a passphrase public_key,fingerprintthe public line ssh-ed25519 … blackbox-agent-…and theSHA256:…fingerprintssh_commandthe ready-to-use command, ssh -i <keyfile> -p PORT root@IP; replace<keyfile>with the path to the file that holds the keycreated,rotated,previous_key_removedwhether the key was just created, whether it was replaced, and whether the old one was deleted
- Every call returns the same key and puts it back if it was deleted from the server in the meantime. On servers ordered on blackbox.md, the key is usually added when the server is created; if the server did not receive it then, it is created at the first call.
- A server has a single agent key, shared by all your tokens.
- With
regenerate=true, a new key is created and the old one is deleted from the server. If the deletion fails, the response showsprevious_key_removed: false: in that case, remove in the panel theblackbox-agent-…key whose fingerprint differs from the one in the response.
The assistant does not need a key for ordinary commands: it uses run_server_command (Running commands on the server through AI). The agent key is useful for copying files with rsync or scp, for interactive sessions in your own terminal, and for tools that need a real SSH connection (for example VS Code Remote - SSH or Ansible). The assistant can use it on its own only if the AI client runs commands on your computer (for example Claude Code or Cursor); otherwise, it can give you the key and the command so that you connect yourself.
How to use the agent key from your terminal
Explicitly ask the assistant to show you the private key: it is instructed not to show passwords and keys in the conversation unless you explicitly ask.
Copy all the text, from
-----BEGIN OPENSSH PRIVATE KEY-----up to and including-----END OPENSSH PRIVATE KEY-----, into a new file, for example~/.ssh/blackbox_agent. After the last line, press Enter so that the file ends with a new line; otherwise SSH may respond withinvalid format.On macOS and Linux, restrict the file's permissions and connect:
chmod 600 ~/.ssh/blackbox_agent ssh -i ~/.ssh/blackbox_agent -p 22 root@SERVER_IPOn Windows, check that the file did not get a
.txtextension. In PowerShell, give access to the file only to your user (otherwise SSH may reject the key withUNPROTECTED PRIVATE KEY FILE), then connect:icacls $env:USERPROFILE\.ssh\blackbox_agent /inheritance:r /grant:r "$($env:USERNAME):(R)" ssh -i $env:USERPROFILE\.ssh\blackbox_agent -p 22 root@SERVER_IP
Copying files with the same key:
rsync -avz -e "ssh -i ~/.ssh/blackbox_agent" ./site/ root@SERVER_IP:/var/www/site/
scp -i ~/.ssh/blackbox_agent backup.tar.gz root@SERVER_IP:/root/Details: Transferring files to the server (scp, rsync, SFTP). For your own permanent access, install your own key: any assistant can replace the agent key at any time with regenerate=true.
The keys in your account
list_ssh_keys, add_ssh_key and delete_ssh_key work with the same keys as the “Chei SSH” (SSH keys) page (blackbox.md/account/ssh-keys, “Contul meu” (My account) → “Chei SSH”): a key added by the assistant appears there, and the other way around. The same rules apply (SSH keys in your account (blackbox.md)):
- at most 20 keys per account (otherwise
too_many_keys); - a single public key line of type
ssh-ed25519,ssh-rsa(at least 2048 bits),ecdsa-sha2-nistp256/384/521,sk-ssh-ed25519@openssh.comorsk-ecdsa-sha2-nistp256@openssh.com(otherwiseinvalid_public_key,unsupported_key_typeorkey_too_weak); - a required name, on a single line, of at most 80 characters;
- a private key is rejected (
private_key_submitted), and so is a key that is already saved (duplicate_key).
Example: “Save the public key below in my account, with the name ‘Work laptop’.” add_ssh_key does not install the key on any server; for that, the assistant then uses add_server_ssh_key. The other way around, delete_ssh_key deletes the key only from your account: on the servers where it is installed, the key keeps working until you remove it from each server.
The keys on the server
These tools use the BLACKBOX management connection, without your password or key. add_server_ssh_key, list_server_ssh_keys and remove_server_ssh_key work with /root/.ssh/authorized_keys, just like the “Add SSH key” section on the server card (Adding and removing SSH keys on the server).
| Tool | What the assistant sends | Result |
|---|---|---|
add_server_ssh_key |
a key from your account (id from list_ssh_keys) or a pasted public key line, exactly one of the two |
added or already_present (it was already installed; nothing changed) |
list_server_ssh_keys |
the server | the type, fingerprint and comment of each key; is_management marks “Management key (blackbox.md)”, is_agent the agent key; plus the password login status (ssh_password_auth) |
remove_server_ssh_key |
the fingerprint from list_server_ssh_keys, the id of a key in your account, or the public key line, exactly one of these |
removed or not_present (the key was not installed) |
set_server_password_auth |
enabled=false or enabled=true |
the applied state, effective: no or yes |
- A pasted key is installed only on that server and is not saved in your account.
set_server_password_authdoes the same thing as the “Disable password login” and “Enable password login” buttons: it writes the settings to a file in/etc/ssh/sshd_config.d/, checks them, reloads SSH, and restores the previous settings if a step fails. The badge on the card changes to “Key-only” or “Password + key” (Enabling and disabling SSH password login). Ask the assistant to use this tool, not to editsshd_configwith commands.
Examples: “Install the ‘Work laptop’ key on the server SERVER_IP.”, “Which SSH keys are installed on the server SERVER_IP?”
Safeguards against losing access
| Situation | Error | Result |
|---|---|---|
| removing the management key | management_key_protected |
always refused, as in the panel |
| on a company server: removing a key managed by BLACKBOX | key_managed |
refused; for changes, write to us |
| removing the last key on a “Key-only” server | last_key_on_key_only_server |
refused; first add another key or turn password login back on |
| turning off password login when none of your keys is installed on the server | no_customer_key_installed |
refused; install a key first |
| another key change is already running on the same server | operation_in_progress |
refused; try again in a minute |
The assistant is instructed to ask for your confirmation before it removes a key from the server, turns off password login or replaces the agent key. However, the confirmation window is shown by the AI client: keep action approval turned on in its settings.
Important The safeguards do not replace your own check. Before you turn off the password or remove a key, check in a new terminal that you can log in with your own key, and keep the current session open. Customers have no web or VNC console; if you lose access, see Lost access to your server (password or key).
How to revoke the assistant's SSH access
Security The private key you receive from
get_server_ssh_accessgivesrootaccess: keep it as safe as a password. It passes through the AI client and the client's provider, like any tool result. Do not send it in chats and do not save it in code repositories.
- Revoke the tokens you no longer use: “Contul meu” (My account) → “Token-uri API” (API tokens) → “Revocă” (Revoke) (API tokens: creating, copying and revoking). Otherwise, any token with
servers:credentialscan reinstall the key at the next call. - Remove the agent key in the panel: on the server card, “Add SSH key” → “Installed keys” → the row with the comment
blackbox-agent-…→ “Remove”, then confirm. “Key removed.” appears (BLACKBOX keys on your server). - If the assistant still needs SSH access, ask it for a new key with
regenerate=true. A call withoutregeneratewould put the old key back.
Common errors
| Error | What it means | What to do |
|---|---|---|
missing_scope: this token does not have '…' |
the token does not have the required permission | create a new token with the permission named in the error |
not_found |
the server or the key does not exist or does not belong to your account; the same code appears on “Managed” servers | ask the assistant to check the list of servers or keys; for “Managed” servers, write to us |
rate_limited |
you went over the tool's limit | wait for the interval in the table above to pass (one hour at most) |
ssh_connection_failed, ssh_key_push_failed, ssh_key_list_failed, ssh_key_remove_failed, password_auth_failed |
BLACKBOX could not complete the operation on the server: usually the server is stopped or still starting, or the management key has been deleted | start the server, wait a minute and try again; if the error persists, write to us: How to contact BLACKBOX support |
Full list: MCP limits and error codes.
Frequently asked questions
Why does the assistant say it doesn't have the get_server_ssh_access tool?
The token does not have the “Vizualizează parolele/accesul serverelor” (View server passwords/access) permission (servers:credentials). You cannot add permissions to an existing token: create a new token.
I removed the agent key in the panel and it appeared again. Why?
An assistant with a token that has servers:credentials requested SSH access again, and get_server_ssh_access put the same key back. Revoke unused tokens or request a new key with regenerate=true.
Does access through the assistant work on a “Key-only” server? Yes. The agent key is installed through the BLACKBOX management connection, and logging in with a key works even when password login is turned off.