---
title: "corestack_ssh_user_key_add"
url: https://docs.corefinity.com/mcp/tools/corestack_ssh_user_key_add
type: tool
last_updated: 2026-11-13
feature: access
related:
  - https://docs.corefinity.com/guides/sites/access-and-security/connection-details.md
---
# corestack_ssh_user_key_add

**Add an SSH key.** Add a public key (OpenSSH, PEM or PuTTY format) to an SSH user of the environment. Never paste a private key. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Runs as a task: yes

## When to use it

Add a public key (OpenSSH, PEM or PuTTY format) to an SSH user of the environment. Never paste a private key.

While `ssh_keys` is on, a key added to the built-in `web` user is an environment-level key of this environment (the keys the Control Panel lists), and the task follows its SSH change (`corestack_ssh_change_get`).

## Inputs

- `user_id` (integer, ≥ 1, required)
- `name` (string, 1–255 characters, required)
- `key` (string, 1–20000 characters, required)

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "key": {
      "maxLength": 20000,
      "minLength": 1,
      "type": "string"
    },
    "name": {
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "user_id": {
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "user_id",
    "name",
    "key"
  ],
  "type": "object"
}
```

## Refusals

- `ssh_person_managed_elsewhere`: the user is a person's own SSH login, whose keys are managed in their profile (while `ssh_keys` is on).
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_ssh_user_key_add",
  "arguments": {
    "user_id": 5021,
    "name": "Staging",
    "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGd1aWRlLWV4YW1wbGUta2V5LW9ubHktbm90LXJlYWw deploy@example.co.uk"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_ssh_user_key_add with user_id 5021, name Staging, key ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGd1aWRlLWV4YW1wbGUta2V5LW9ubHktbm90LXJlYWw deploy@example.co.uk. (Add an SSH key.) Tell me what it returned.
```

## The same task elsewhere

- Guide: [Connection details](https://docs.corefinity.com/guides/sites/access-and-security/connection-details.md)
