Reset your VPS root password or boot into rescue mode
Locked out of a server? Use the lightest tool that fixes it: a password reset if the password is lost, the browser console if SSH is blocked, rescue mode if the server won't boot, and a rebuild only as the last resort.
Before you start
- Your client area login, and the VPS's name or IP address from the Services list.
- An SSH client: Terminal on macOS or Linux, PowerShell or PuTTY on Windows. See Connect to your VPS over SSH.
- If the server still runs, a snapshot taken first. Three on-demand snapshots are free on every VPS.
Password reset, console or rescue mode: pick the right tool
| What's wrong | Use | Your data |
|---|---|---|
| Root password lost or never saved | A. Reset root password | Kept |
| A firewall or SSH change locked you out, server still running | B. Browser console | Kept |
| Won't boot, stops in emergency mode, or the disk is full | C. Rescue mode | Kept |
| Beyond repair, or you want a clean start | D. Rebuild | Erased |
Option A: Reset the root password
-
Open the VPS in the client area
Go to Servicesyour VPSReset root password. Applying the new password can involve a quick restart, so do it when a minute of downtime is acceptable.
-
Choose a strong password and save it
Use at least 16 characters, or accept the generated one, and store it in a password manager. We never ask for it, in tickets or anywhere else.
-
Log in
ssh root@203.0.113.42
Using key-only SSH? If you turned password logins off, as Secure a new Linux VPS recommends, the new password works in the console but not over SSH. To add a key from a new computer, allow passwords for a minute, then switch them off again. If root login is off as well, install the key for your sudo user rather than root:
# on the server, in the browser console
echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config.d/00-allow-passwords.conf
systemctl reload ssh # AlmaLinux / Rocky: systemctl reload sshd
# on your computer: your sudo user, or root if root login is still allowed
ssh-copy-id deploy@203.0.113.42
# back on the server: remove the exception
rm /etc/ssh/sshd_config.d/00-allow-passwords.conf && systemctl reload ssh
The file is named 00-allow-… so it sorts ahead of 00-hardening.conf: SSH uses the first value it reads, and files in that folder are read in alphabetical order. AlmaLinux and Rocky 8 don't read the folder, so on those change the PasswordAuthentication line in /etc/ssh/sshd_config instead.
Option B: Use the browser console
Servicesyour VPSConsole opens the server's screen and keyboard in a browser tab, as if a monitor were plugged in. It doesn't use SSH or the network, so it works when a firewall rule or a broken SSH config has shut you out.
- Log in as
rootwith the password. SSH keys don't apply at the console. - The console uses a US keyboard layout. If pasting doesn't work, type the command.
- A black screen is usually just blanking: press Enter.
Then undo whatever locked you out. These commands cover the usual culprits:
# firewall: is SSH allowed?
ufw status numbered
ufw allow 22/tcp
# SSH config valid? then restart and check the service
sshd -t && systemctl restart ssh
systemctl status ssh --no-pager
# banned by fail2ban? (your own public IP)
fail2ban-client set sshd unbanip 198.51.100.7
# firewall: is SSH allowed?
firewall-cmd --list-all
firewall-cmd --permanent --add-service=ssh && firewall-cmd --reload
# SSH config valid? then restart and check the service
sshd -t && systemctl restart sshd
systemctl status sshd --no-pager
# custom SSH port? SELinux must allow it too
semanage port -a -t ssh_port_t -p tcp 2222
# banned by fail2ban? (your own public IP)
fail2ban-client set sshd unbanip 198.51.100.7
Option C: Boot into rescue mode
Rescue mode starts the VPS from a small temporary Linux system, with your own disk attached but not in use. From there you can repair files the broken system won't let you reach.
-
Enable rescue and connect
Choose Servicesyour VPSRescue. The VPS restarts, and the panel shows the temporary root password. Connect as usual. SSH will warn that the host key has changed, which is expected here, so clear the old key first:
ssh-keygen -R 203.0.113.42 ssh root@203.0.113.42 -
Find your disk
lsblk -o NAME,FSTYPE,LABEL,SIZE NAME FSTYPE LABEL SIZE vda 80G ├─vda1 ext4 cloudimg-rootfs 79.9G ← your system ├─vda14 4M └─vda15 vfat UEFI 106MYour system is the largest ext4 or xfs partition. If its type is
LVM2_member, runvgchange -ayand use the/dev/mapper/…-rootvolume thatlvslists. -
Mount it and step inside
mount /dev/vda1 /mnt for d in dev proc sys run; do mount --rbind /$d /mnt/$d; done chroot /mnt /bin/bashYour prompt now acts on the installed system, so commands such as
passwdandnanochange your server, not the rescue system. -
Fix the problem
# forgotten password passwd root touch /.autorelabel # AlmaLinux / Rocky only: SELinux relabels on next boot # boots into emergency mode: check fstab against the real UUIDs blkid nano /etc/fstab # fix or comment out the bad line, or add "nofail" findmnt --verify # SSH won't start: show the broken line sshd -t # disk full: find what filled it df -h / du -xh --max-depth=1 / | sort -h | tail -
Leave rescue mode
exit umount -R /mntThen turn rescue off from the same Rescue page so the VPS boots from its own disk. Run
ssh-keygen -Ronce more before reconnecting, because the host key changes back.
Option D: Rebuild (reinstall) the OS
A rebuild erases the whole disk. Websites, databases, mail and settings are gone afterwards. If the server still boots, take a snapshot first. If it doesn't, use rescue mode to copy what you need off it, for example with rsync or scp to another machine.
Go to Servicesyour VPSRebuild, choose one of the 12 OS images (Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS Stream, Fedora or Windows Server), set a new root password and confirm. The server is usually ready within minutes. Then work through Secure a new Linux VPS before you restore your data.
If you pay for the backups add-on (+20%, daily copies kept for 14 days), you can also roll back to one of those instead of rebuilding from scratch.
On a dedicated server
Dedicated servers include IPMI, which gives you the machine's own console (KVM-over-IP), power control and virtual media. The same ideas apply:
Console
Open the KVM console from IPMI and work as in Option B. It shows the screen from power-on, so you can also watch the boot and choose a GRUB entry.
Rescue
Attach a live Linux ISO through virtual media, or ask us to boot one. Disk names differ: NVMe partitions look like /dev/nvme0n1p2, and software RAID needs mdadm --assemble --scan before you mount /dev/md0.
Troubleshooting
SSH says "REMOTE HOST IDENTIFICATION HAS CHANGED"
Expected after entering or leaving rescue mode, or after a rebuild: the server presents a different key. Run ssh-keygen -R 203.0.113.42 and connect again. If you see it when nothing has changed, don't log in; open a ticket.
The console rejects a password I know is right
Usually the keyboard: the console expects a US layout, so symbols such as @, " and # may land on different keys. Check Caps Lock, or reset to a temporary password of letters and digits, log in, and change it with passwd.
mount says "unknown filesystem type 'LVM2_member'"
The system disk uses LVM, so mount the logical volume rather than the partition. Run vgchange -ay to activate it and lvs to list the volumes, then mount the root one, for example mount /dev/mapper/almalinux-root /mnt.
AlmaLinux still refuses the password I set in rescue
SELinux is blocking the changed password file. Boot rescue again, mount and chroot as above, run touch /.autorelabel, then leave rescue. The next boot relabels the disk and takes a few minutes longer than usual.
The server stops at "You are in emergency mode"
A line in /etc/fstab points at a disk or UUID that no longer exists, often after removing a volume. Fix it from rescue (step 4), or add nofail to non-essential mounts so a missing disk can't stop the boot again.
Was this guide helpful?Your answer stays in this browser; nothing is sent unless you write to us below.
Related guides
All 16 guidesStill stuck? Ask an engineer.
Tickets and email are answered 24/7 in English and Hindi. Include the VPS name, what changed last and the exact error or what the console shows.