SSH keys

Coolify uses SSH private keys to connect to servers without passwords and to access private Git repositories through deploy keys. Keys belong to the active Coolify team and can be reused by resources in that team.

Use keys without a passphrase

Coolify must use SSH keys without an interactive prompt. Do not add a passphrase or a second-factor prompt to a key used by Coolify.

How Coolify uses a key pair

An SSH key pair has two parts:

  • Coolify stores and uses the private key when it starts an SSH connection.
  • You add the matching public key to the server account's ~/.ssh/authorized_keys file or to the Git provider as a deploy key.

The public key does not grant access without its matching private key. Never copy the private key to a managed server or Git repository.


Create an SSH key

Open Keys & Tokens in the main sidebar, select Private Keys, then open New private key.

Private Keys page in Coolify

Select Generate ED25519 for the default choice. Use Generate RSA only when the target system does not accept ED25519 keys. Coolify generates 4096-bit RSA keys.

Coolify generates and saves the key immediately. Select its Edit icon to review the public key or change the name to identify its purpose, such as production-servers. Select Save changes after editing.

New Private Key form with key generation and public key fields

Coolify rejects invalid private keys, keys with a passphrase, and duplicate keys in the active team. A new or changed key must also meet the key type rules above. The error message tells you which rule the key does not meet.

Keys that you added before these checks continue to work, and you can still rename them. To replace a weak key, open the key and select Rotate key. Coolify moves its servers to a new Ed25519 key.


Authorize the public key on a server

Add the public key to the account Coolify will use for SSH. The following commands use root; replace it with the configured non-root account when needed.

Copy the public key from Coolify

Open Keys & Tokens > Private Keys, select its Edit icon, and copy Public key.

Connect to the server

From a trusted terminal, connect with an existing administrative method:

ssh root@<server-ip>

If SSH uses another port, add -p <ssh-port>.

Add the key to the SSH account

On the server, run:

mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys

Paste the complete public key on its own line. Save the file, then run:

chmod 600 ~/.ssh/authorized_keys

Do not remove the key used by your current SSH session until the new Coolify connection has been verified.

For server requirements and firewall rules, follow OpenSSH.


Select and verify a server key

For a new server, select the key in the Private Key field while following Add Server.

For a connected server:

  1. Open Servers and select the server.
  2. Open Private Key in the server settings.
  3. Find the authorized key and select Use this key.
  4. Select Check connection.

The change is verified when Coolify reports that the server is reachable. If the check fails, restore the previously working key selection and confirm that the new public key is in the configured SSH user's ~/.ssh/authorized_keys file.


Use a key for a private Git repository

When creating an application from a private repository through a deploy key, select or create a private key in Coolify and add its public key to the repository's deploy-key settings.

Repository access and server access are separate. Adding a public key to a Git provider does not authorize that key on a server, and adding it to ~/.ssh/authorized_keys does not grant repository access.

Use a dedicated key when you want to rotate or revoke repository access without affecting server connections.


Rotate an SSH key

Rotate key moves every server that uses a key to a new key. Coolify adds the new public key to ~/.ssh/authorized_keys on each server, so you do not have to change the servers yourself.

Start the rotation

  1. Open Keys & Tokens > Private Keys and select the Edit icon of the key.
  2. Select Rotate key. The button shows only when a server uses the key.
  3. Select New key type: Ed25519 (recommended) or RSA 4096 for hosts that do not accept Ed25519, for example FIPS hosts.
  4. Select Rotate key in the dialog.

Check the result

Coolify creates the new key with the old name and (rotated <date>). For each server, Coolify:

  1. adds the new public key to ~/.ssh/authorized_keys of the SSH user
  2. logs in with the new key
  3. moves the server to the new key

If the new key cannot log in, Coolify removes it from the server again and the server stays on the old key.

The dialog shows a status for each server:

StatusMeaning
MovedThe server uses the new key.
FailedThe server stays on the old key. The message shows the reason.
Old key not foundThe old key is not in ~/.ssh/authorized_keys, so Coolify cannot replace it. Add the new public key on the server yourself.
UnreachableCoolify could not connect, or the server is disabled.
TransferredAnother Coolify instance manages the server now.

To try again for the servers that stay on the old key, select Rotate again. Coolify uses the same new key.

Wait for the old key to be removed

Coolify removes the old public key from each moved server after at least one hour, or after the deployment timeout of the server if it is longer. Deployments, backups, and scheduled tasks that started before the rotation can finish with the old key.

Delete the old key

Applications and Git sources stay on the old key. Move them to another key yourself. When nothing uses the old key, the dialog shows Delete old key.

Deleting a private key in Coolify does not remove its public key from servers. To remove it, rotate the key before you delete it, or select the SSH key option when you remove a server.

For a Git deploy key, create a new key, add its public key to the repository, update the application, and verify the access with a deployment. Then remove the old deploy key from the Git provider.


Delete unused keys

The Private Keys list marks a key Unused when no server, application, GitHub App, GitLab App, Gitea App, or SFTP backup storage references it. The Used by list of a key shows the servers, applications, and Git apps that use it.

  • Open an unused key and select Delete to remove it.
  • Select Delete unused keys on the list page to remove all keys currently marked unused for the active team.

Coolify prevents its safe-delete operation from removing a key that is still referenced. Remove or replace every dependency before deleting the key.


Security and storage

Only team administrators and owners can create, change, or delete private keys. Give each key a purpose-specific name and avoid sharing one key across unrelated environments.

Coolify encrypts the private-key value stored in its database. On a self-hosted instance, Coolify also writes the key to its SSH key storage with restrictive file permissions so the SSH client can use it. Every hour, Coolify deletes key files that nothing uses and that did not change for one day. Coolify writes a key file again when it needs it. Protect the Coolify database, /data/coolify/source/.env, /data/coolify/ssh/keys/, and instance backups as privileged recovery material.

For a self-hosted instance migration, follow Restore Coolify so the database, encryption key, and SSH key files remain consistent.

On this page