Protect your data firstKeep a current off-server backup before reinstalling, updating, changing firewall rules, or running an application installer.
On this page
Public and private keys
The public key can be installed on your own server. The private key stays on your trusted device, protected by a passphrase when possible. Never paste it into chat, a ticket, a website repository, or a screenshot.
A safe transition
- Keep your current session open and verify a recovery console is available.
- Add the public key to the intended account using your OS documentation.
- Open a second SSH session and confirm the correct account can log in using the key.
- Verify any required elevated access separately.
- Only then consider changing password-login or root-login policy.
Do not overwrite the entire authorized-key file when other valid keys are present. Record which key belongs to each device and revoke lost-device access through a verified management session.
Official reference
Ubuntu OpenSSH guidance. Follow instructions for your actual operating system and keep a recovery path.