> For the complete documentation index, see [llms.txt](https://docs.plenit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plenit.com/docs-en/productos/servers-2/how-to/how-to-configure-an-ssh-key-existing-server.md).

# How to Configure an SSH Key on an Existing Server

SSH lets you manage a server remotely from the command line, with the connection encrypted through port 22.

If the server is already deployed, you add the key from the section **SSH Keys** of the subscription, without recreating it.

> #### 👍 What you get
>
> An active SSH key on a server already up and running, and the private key in your possession to connect securely.

> #### ❗️ Activating the key restarts the server
>
> Unlike configuring it during setup, activating an SSH key on an existing server **restarts the machine** and **generates a new password**.&#x20;
>
> Do it in a window where you can accommodate that restart, not in full production.

### How the key pair works

SSH uses two pieces that go together: the public key stays on the server and you keep the private key. The private one is what identifies you when connecting, so it isn't shared. You can find more details in [How to configure an SSH key on a new server.](/docs-en/productos/servers/how-to/how-to-configure-an-ssh-key-new-server.md)

| Item        | Where it lives   | What it's for                              |
| ----------- | ---------------- | ------------------------------------------ |
| Public key  | On the server    | Verifies who connects                      |
| Private key | On your computer | Identifies you when connecting; not shared |

### Before you start

* Be registered on the Plenit platform and have permission to manage servers.
* Have a server deployed in a subscription of **Servers**.
* Be able to tolerate a server restart during activation.

### Step 1. Go to the SSH Keys section

1. Go to the subscription of **Servers** from its card.
2. In the right-hand side submenu, open **SSH Keys**.
3. Click **Create SSH Key**.

{/\* 📸 CAPTURE 1 · side submenu with "SSH Keys" and the Create SSH Key button \*/}

![Access to the SSH Keys section with the Create SSH Key button](https://REEMPLAZA-URL/servidores-howto-ssh-existente-01.png)

### Step 2. Create and activate the key

1. Enter a **name** for the key.
2. Check **Generate a new key**.
3. Select the **servers** where you want to activate it.
4. Click **Continue**.

The platform warns that activating the key restarts the server and generates a new password. Click **Confirm** to continue. The restart and key generation begin.

{/\* 📸 CAPTURE 2 · key dialog with "Generate a new key" and the selection of servers \*/}

![SSH key registration and selection of the servers where it will be activated](https://REEMPLAZA-URL/servidores-howto-ssh-existente-02.png)

> #### ❗️ Save the private key and password: they are shown only once
>
> During the process, two pieces of data appear that cannot be consulted again. Copy and save them as soon as you see them:
>
> * The **private key** SSH. Click **Confirm** after copying it.
> * The **new password** of the server. Click **Confirm** after copying it.

### Step 3. Connect with the key

Save the private key in a file and protect it: SSH rejects a key with permissions that are too open.

On Linux or macOS:

```bash
# Restrict the key permissions
chmod 600 ~/.ssh/plenit-srv01

# Connect (username and IP of your server)
ssh -i ~/.ssh/plenit-srv01 <username>@<SERVER-IP>
```

On Windows, with the OpenSSH client from PowerShell:

```powershell
icacls "C:\Users\<your-user>\.ssh\plenit-srv01" /inheritance:r /grant:r "%USERNAME%:R"
ssh -i "C:\Users\<your-user>\.ssh\plenit-srv01" <username>@<SERVER-IP>
```

> #### 📘 The user depends on the image
>
> The username for connecting is determined by the server's operating system. If you're not sure, confirm it based on the deployed image.

### If something does not fit

| Symptom                                        | Likely cause                                               | What to do                                           |
| ---------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------- |
| The server restarted without warning anyone    | Activation restarts the machine                            | Plan activation in a maintenance window              |
| You don't have the private key or the password | They were shown only during the process and were not saved | Create a new key; another password will be generated |
| SSH rejects the key due to permissions         | The private key is accessible to other users               | Apply `chmod 600` (Linux) or `icacls` (Windows)      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.plenit.com/docs-en/productos/servers-2/how-to/how-to-configure-an-ssh-key-existing-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
