Why SSH Keys?
SSH key authentication is more secure than passwords. A private key never leaves your machine; the server only stores the corresponding public key.
Generating a Key Pair
Linux / macOS
$ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/lightyear_keyThis creates:
~/.ssh/lightyear_key— private key (keep this secret)~/.ssh/lightyear_key.pub— public key (upload this)
Windows (PowerShell)
ssh-keygen -t ed25519 -C "[email protected]" -f "$env:USERPROFILE\.ssh\lightyear_key"Adding Your Key to LightYear
- Copy your public key:
>_BASH$cat ~/.ssh/lightyear_key.pub
- Go to Account → SSH Keys → Add SSH Key.
- Paste the public key and give it a label.
Using the Key at Deploy Time
When deploying a server, select your saved key from the SSH Key dropdown. The key is injected into /root/.ssh/authorized_keys automatically.
Connecting
$ssh -i ~/.ssh/lightyear_key root@<SERVER_IP>Rotating Keys
To rotate a key:
- Generate a new key pair.
- Add the new public key to your running server:
echo "<new-pubkey>" >> ~/.ssh/authorized_keys - Update your LightYear account with the new key.
- Remove the old key from
authorized_keys.
