Root Password Reset
From PrgmrWiki
The prgmr.com rescue image can be used to reset the root password for the vps similar to a rescue disk like tomsrtbt or the debian installer rescue mode. If you run netbsd, you can also boot the netbsd installer from the rescue disk for a similar process.
- If the vps (domU or domain) is still running, shut it down with the menu on the host server (dom0).
Name ID Mem VCPUs State Time(s) build 447 1024 1 -b---- 16.6 Options for build 1. console 2. create/start 3. shutdown 4. destroy/hard shutdown 5. reboot 6. exit press the number> 3 </li>
This will signal the domain to safely shutdown like the shutdown command. - When it is stopped running, opening the menu will say
Error: Domain 'build' does not exist.
which is normal, it just means the vps isn't running. Choose create to start the vps:Error: Domain 'build' does not exist. Options for build 1. console 2. create/start 3. shutdown 4. destroy/hard shutdown 5. reboot 6. exit press the number> 2
The vps will start booting with pvgrub and will load the grub menu from the rescue image:
GNU GRUB version 0.97 (1048576K lower / 0K upper memory) +-------------------------------------------------------------------------+ | user domU bootloader | | CentOS rescue (2.6.18-164.6.1.el5xen) | | CentOS 5.4 installer | | NetBSD 5.0.1 installer | | | | | | | | | | | | | | | | | +-------------------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line.
- Choose CentOS rescue to boot the read only rescue image. When it is finished booting, login as root at the prompt with no password:
CentOS release 5.4 (Final) Kernel 2.6.18-164.6.1.el5xen on an x86_64 build.xen.prgmr.com login: root [root@build ~]#
- Mount your root filesystem (by default /dev/xvda1) and chroot to it:
[root@build ~]# mount /dev/xvda1 /mnt [root@build ~]# chroot /mnt build:/#
- Change the root password with passwd:
build:/# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully build:/#
- Exit, unmount, and shutdown:
build:/# exit exit [root@build ~]# umount /mnt [root@build ~]# shutdown -h now Broadcast message from root (xvc0) (Tue Jan 26 15:33:15 2010): The system is going down for system halt NOW! INIT: Switching to runlevel: 0 INIT: Sending processes the TERM signal
- Start the vps again as in step 2.