Reset Password on a Cloud Server¶
Sometimes you can forget the root password of your server. Gandi provide a ramdisk-rescue kernel to simplify the process of resetting this password. The general process consist of these different steps :
- Changing the kernel used by the server to ramdisk-rescue.
- Restarting server.
- Connecting to the emergency console.
- Chroot the environment.
Please refer to Change Boot System on Volume for this operation and choose ramdisk-rescue.
Note the original kernel used before changing it, you will have to switch back to it after the procedure.
When connected , create
/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
passwd command :
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/
You can now switch back to the original server kernel. Be sure to do a stop and start of the server to be sure all is in order and taken in account.