How to Reset the Root Password on a Cloud Server¶
This page describes how to reset the root password of your server in the case that you forget it.
Gandi provides a ramdisk-rescue kernel to simplify the process of resetting your root password. You will need to complete these steps:
Change the kernel used by the server to ramdisk-rescue.
Restart the server.
Connect to the emergency console.
Chroot the environment.
Reset the kernel and restart your server.
These steps are explained in more detail below.
Follow our directions for changing the boot system on a volume and choose ramdisk-rescue as your boot system.
Make sure you note the original kernel used, since you will need to switch back after resetting your password.
Follow our directions for restarting your server.
Follow our directions for connecting to your emergency console.
When connected , create a
/mnt/d folder in order to mount your disk:
# mkdir /mnt/d # mount /dev/xvda1 /mnt/d
Now, prepare chroot:
# mount --bind /dev/ /mnt/d/dev # mount --bind /dev/pts /mnt/d/dev/pts # mount --bind /proc/ /mnt/d/proc # mount --bind /sys/ /mnt/d/sys
Then, make chroot:
# chroot /mnt/d
Now, change the root password with the
Quit chroot environment and unmount these folders:
# exit # umount -v /mnt/d/dev/pts # umount -v /mnt/d/dev/ # umount -v /mnt/d/sys # umount -v /mnt/d/proc # umount -v /mnt/d/