You changed something — sshd config, ufw rule, sudoers, or PAM — and now you can't get in. Or maybe you forgot the root password. Or fail2ban banned your own IP. Whatever happened, the VPS is running, your data is intact, but you can't reach it. This guide covers the recovery routes that actually work, in order from least to most disruptive: console access, rescue mode, snapshot rollback, and full rebuild as last resort.

🔓

TL;DR: Try the provider's web console first — it gives you keyboard access to the VPS regardless of SSH or firewall state. If that doesn't work, boot into rescue mode (a separate live OS that mounts your disk) to fix configs from outside. Snapshot rollback is the nuclear option if you have a recent snapshot. Full rebuild is the truly nuclear option (and only acceptable if you have backups).

What we'll cover

  1. Before you start: triage
  2. Route 1: Provider web console
  3. Route 2: Rescue mode
  4. Route 3: Snapshot rollback
  5. Route 4: Rebuild
  6. Common in-rescue fixes
  7. OliveVPS-specific recovery
  8. Prevention
  9. FAQ

Before you start: triage

Diagnose what kind of locked-out you are. The fix depends on it:

Console access (route 1 below) gives you a fix path for all of these without leaving the VPS. It's the first thing to try.

Route 1: Provider web console (try this first)

Every reputable VPS provider — including OliveVPS — gives you a browser-based serial or VNC console to your VPS. This works regardless of SSH state, firewall rules, or network issues, because it's connecting through the hypervisor, not over the public internet to your VPS.

On OliveVPS:

  1. Log into app.olivevps.com with your account credentials.
  2. Go to Services → My Services → click the affected VPS.
  3. Click "Console" (or VNC, depending on the panel version).
  4. A new browser tab opens with a terminal showing your VPS login prompt — same as if you were sitting in front of it.

From console, you can log in as root (with the password from your provisioning email or whatever you changed it to) and fix things directly: edit configs, restart services, flush firewall rules. No SSH or network needed.

If you've forgotten the root password, console alone won't help — you'll need rescue mode (next).

Route 2: Rescue mode

Rescue mode boots your VPS from a separate live Linux ISO with your existing disk attached but not mounted as root. You log into the rescue OS, mount your disk, and edit files from outside your broken system. It's the equivalent of booting a USB recovery stick on physical hardware.

When rescue mode helps:

On OliveVPS, switch to rescue mode from the control panel: Services → My Services → VPS → "Boot into Rescue Mode". The VPS reboots into a temporary rescue OS; you SSH in with credentials shown in the panel. Your real disk is at /dev/vda (typically). Mount it:

# Inside the rescue environment
sudo mkdir /mnt/recover
sudo mount /dev/vda1 /mnt/recover

# For chroot operations:
sudo mount --bind /dev /mnt/recover/dev
sudo mount --bind /proc /mnt/recover/proc
sudo mount --bind /sys /mnt/recover/sys
sudo chroot /mnt/recover

# You're now "inside" your real system.
# Fix what's broken, then exit and reboot.

When you're done, exit the chroot, unmount, and reboot back to normal mode from the control panel. The VPS comes up with your fixes applied.

Route 3: Snapshot rollback

If you took a snapshot before making the change that broke things, rollback restores the entire VPS to that point. Pros: fast (minutes), preserves filesystem state exactly. Cons: any changes after the snapshot are lost — including legitimate work, database writes, file uploads.

Decide before rolling back: is the data created since the snapshot more valuable than the time to fix the lockout? For a quick config break, rescue mode is usually the right call. For a deeply corrupted system, rollback may be faster.

On OliveVPS: Services → My Services → VPS → Snapshots → Restore. Restoration takes 2-10 minutes depending on disk size. The VPS reboots when complete.

Route 4: Rebuild (last resort)

Reinstalling the OS wipes the disk and gives you a fresh VPS with the same IP, same hostname, same plan — but no data. You're back to a clean Ubuntu install. This only makes sense if:

On OliveVPS: Services → My Services → VPS → Reinstall. Choose your OS image. The VPS rebuilds in 1-3 minutes. New root password and SSH keys are emailed to you.

Common in-rescue fixes

Reset root password (rescue mode)

# After mounting and chrooting:
passwd root
# (set new password, exit chroot, reboot)

Fix broken sudoers

# In chroot:
pkexec visudo
# OR if visudo errors:
sed -i 's/^bad_line/#bad_line/' /etc/sudoers

Restore SSH access

# Re-enable password auth temporarily (in chroot)
sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config

# Re-enable root login (if you want it; usually no)
sed -i 's/^PermitRootLogin .*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config

# Add a known SSH key for your user
mkdir -p /home/youruser/.ssh
echo 'ssh-ed25519 AAAA...' >> /home/youruser/.ssh/authorized_keys
chown -R youruser:youruser /home/youruser/.ssh
chmod 700 /home/youruser/.ssh
chmod 600 /home/youruser/.ssh/authorized_keys

Disable a broken firewall

# In chroot, flush iptables/ufw rules so you can reach the VPS again
ufw disable
# OR
iptables -F
iptables -P INPUT ACCEPT

Unban your IP from fail2ban

fail2ban-client unban 

# Or temporarily stop fail2ban so you can get in
systemctl stop fail2ban

OliveVPS-specific recovery

We try to make recovery boring. Specifically:

Prevention

VPS hosting with real recovery options

Web console, rescue mode, snapshots, 24/7 support on every plan. We've intentionally never had a customer permanently lose access — and we're proud of that.

See VPS Plans →

FAQ

Can I reset my VPS root password without losing data?

Yes — boot into rescue mode, chroot into your real system, run passwd root. Data is untouched. Reinstall is only needed if you've also lost SSH and console access entirely.

Why is my VPS console showing only a black screen?

Three common causes: (1) VPS is genuinely off — power it on from the panel; (2) console output redirected to a serial port that isn't enabled — check kernel cmdline; (3) graphics-mode console only, but your OS boots to text — try pressing Enter or arrow keys to wake it.

How long does rescue mode take?

On OliveVPS, ~60 seconds to switch into rescue mode (the VPS reboots), then you can SSH into the rescue environment immediately. Switching back takes the same time.

Will rebuilding my VPS keep my IP address?

Yes — reinstall keeps the same IPv4 and IPv6 addresses on OliveVPS. DNS and connected services don't break. Only the disk contents are wiped.

Can someone else lock me out of my VPS?

If your account credentials are compromised, yes. Use 2FA on your provider account, use SSH keys with strong passphrases, and limit who has access. Our control panel supports 2FA — enable it.

🐱
The OliveVPS Team

Most lockouts we see are self-inflicted — a config change that worked in testing but not in production, or an over-eager firewall rule. The recovery options here exist precisely because everyone does this eventually.