How to Configure an SSH Key on an Existing Server
SSH lets you administer 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 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.
Do it in a window where you can accommodate that restart, not in the middle of production.
How the key pair works
SSH uses two pieces that go together: the public key stays on the server and the private one you keep. The private one is what identifies you when connecting, so it is not shared. You can find more detail in How to configure an SSH key on a new server.
Public key
On the server
Verifies who connects
Private key
On your computer
Identifies you when connecting; it is not shared
Before you begin
Be registered on the Plenit platform and have permission to manage servers.
Have a server deployed in a subscription of Servers.
Be able to accommodate a server restart during activation.
Step 1. Access the SSH Keys section
Enter the subscription of Servers from its card.
In the right side menu, open SSH Keys.
Click Create SSH Key.

Step 2. Create and activate the key
Enter a name for the key.
Check Generate a new key.
Select the servers servers on which you want to activate it.
Click Continue.
The platform warns that activating the key restarts the server and generates a new password. Press Confirm to continue. The restart and key generation begin.

❗️ Save the private key and the password: they are shown only once
During the process, two pieces of data appear that cannot be consulted again. Copy them and save them as soon as you see them:
The private key SSH. Press Confirm after copying it.
The new password of the server. Press 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:
On Windows, with the OpenSSH client from PowerShell:
📘 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 according to the deployed image.
If something doesn't fit
The server restarted without notifying anyone
Activation restarts the machine
Schedule the 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)
Last updated
Was this helpful?

