Root Password Reset

From PrgmrWiki
Revision as of 21:21, 28 March 2014 by Srn (talk | contribs)

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.

  1. If the vps (domain) is still running, shut it down using the Prgmr menu.
    Name                                        ID   Mem VCPUs      State   Time(s)
    build                                      447  1024     1     -b----     16.6
    
    Options for build
    1. out of band console (press ctrl-] to escape, not resizeable)
    2. create/start (try this if the vps "does not exist")
    3. shutdown
    4. destroy/hard shutdown
    5. reboot
    6. swap i386/amd64 bootloaders (pvgrub) currently i386
    7. view/add/remove ssh authorized_keys
    8. set reverse dns
    9. exit
    press the number> 3
    
    This will signal the domain to safely shutdown like the shutdown command.
  2. 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. out of band console (press ctrl-] to escape, not resizeable)
    2. create/start (try this if the vps "does not exist")
    3. shutdown
    4. destroy/hard shutdown
    5. reboot
    6. swap i386/amd64 bootloaders (pvgrub) currently i386
    7. view/add/remove ssh authorized_keys
    8. set reverse dns
    9. exit
    press the number> 2     
    

    The domain 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 bootloader configuration                                           |  
     | CentOS 5.5 rescue (2.6.18-194.3.1.el5xen)                               |
     | CentOS 5.5 installer                                                    |
     | Ubuntu 10.04 LTS 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.
    
  3. 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 ~]#
    
  4. Mount your root filesystem (by default /dev/xvda1) and chroot to it:
    [root@build ~]# mount /dev/xvda1 /mnt
    [root@build ~]# chroot /mnt
    build:/#
    
  5. Change the root password with passwd:
    build:/# passwd
    Enter new UNIX password: 
    Retype new UNIX password: 
    passwd: password updated successfully
    build:/#
    
  6. 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
    
  7. Start the vps again as in step 2, but let it load the vps instead of choosing the rescue image.