SSH setup β Moodle migration VPS
Context Fresh OVH VPS (Ubuntu 25.04) for the Moodle migration. key-based SSH with simple commands to remember.
Goal
Connect as ubuntu via SSH keys (no passwords long-term), with a per-host key + alias.
What I did
Generated a host-specific key (Ed25519)
ssh-keygen -t ed25519 -C "taksumaq@ubuntu ovh-newroad-moodle"
# saved as: ~/.ssh/id_ed25519_ovh-newroad-moodle (and .pub)
- OVH docs suggested setting
-a 256(KDF rounds). I decided not to and use defaults.
Added an SSH alias
Created ~/.ssh/config:
Host ovh-newroad
HostName 158.69.206.122
User ubuntu
IdentityFile ~/.ssh/id_ed25519_ovh-newroad-moodle
IdentitiesOnly yes
Permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config
First connect & forced password change
First contact shows the host-key prompt β typed yes.
OVH enforces a password change on first login, so I forced a TTY:
ssh -tt ovh-newroad
# changed the initial password when prompted
Added the public key to the server
ssh-copy-id -i ~/.ssh/id_ed25519_ovh-newroad-moodle.pub ovh-newroad
Then tested key login (was asked to provide my key passphrase on a popup prompt):
ssh ovh-newroad
Gotchas
- The authorization prompt on first login needed the passphrase created when generating the ssh key.
- File perms matter:
~/.ssh700,~/.ssh/config600, server-side~/.ssh/authorized_keys600. - When reinstalling the system the hostβs key change and hence the key entries for that host need to be remove. We do so by running
ssh-keygen -R <hostname>. Otherwise it wonβt let you connect.
Current state
-
Alias
ovh-newroadworks:ssh ovh-newroad -
Key file:
~/.ssh/id_ed25519_ovh-newroad-moodle -
User:
ubuntu@158.69.206.122 -
Logged in successfully.