Difference between revisions of "Root Password Reset"

From PrgmrWiki
Line 25: Line 25:
  
 
</pre> This will signal the domain to shut down safely.</li>
 
</pre> This will signal the domain to shut down safely.</li>
<li>When it is stopped running, opening the menu will say
+
<li>When the machine is stopped, the Management Console menu will return. Entering 3 again will generate a new menu with a different heading:
 
<pre>
 
<pre>
 
Error: Domain 'build' does not exist.
 
Error: Domain 'build' does not exist.
</pre> which is normal, it just means the vps isn't running. Choose create to start the vps:
+
</pre> which is normal, it just means the vps isn't running. Choose create/start to start the vps:
 
<pre>
 
<pre>
 +
Domain cnrylefanu is not running.
  
Error: Domain 'build' does not exist.                                    
+
    Wiki at http://wiki.prgmr.com
                                                                         
+
    Please contact support@prgmr.com with any issues accessing your machine.
                                                                         
+
 
Options for build                                                       
+
    Options for "cnrylefanu"
1. out of band console (press ctrl-] to escape, not resizeable)
+
    1. out of band console (press ctrl-] to escape, not resizeable)
2. create/start (try this if the vps "does not exist")
+
    2. create/start, opens OOB console (try this if the machine is not running)
3. shutdown
+
    3. shutdown (requests operating system to shut down)
4. destroy/hard shutdown
+
    4. force power off (destroy/hard shutdown)
5. reboot
+
    5. reboot (requests operating system to reboot)
6. swap i386/amd64 bootloaders (pvgrub) currently i386
+
    6. swap i386/amd64 bootloaders currently "amd64"
7. view/add/remove ssh authorized_keys
+
    7. view/add/remove ssh authorized_keys
8. set reverse dns
+
    8. set reverse dns
9. exit
+
    9. swap pvgrub/grub2 bootloaders currently "pv-grub"
press the number> 2     
+
    0. exit
 +
    enter selection> 2     
 
</pre>
 
</pre>
 
The domain will start booting with pvgrub and will load the grub menu from the rescue image:
 
The domain will start booting with pvgrub and will load the grub menu from the rescue image:
 
<pre>
 
<pre>
   
+
     GNU GRUB  version 0.97  (262144K lower / 0K upper memory)
     GNU GRUB  version 0.97  (1048576K lower / 0K upper memory)
+
 
 
 
  +-------------------------------------------------------------------------+
 
  +-------------------------------------------------------------------------+
 
  | user bootloader configuration                                          |   
 
  | user bootloader configuration                                          |   
  | CentOS 5.5 rescue (2.6.18-194.3.1.el5xen)                               |
+
  | Debian GNU/Linux, kernel 3.16.0-4-amd64 Live Rescue                    |
  | CentOS 5.5 installer                                                    |
+
| Debian GNU/Linux, kernel 3.16.0-4-amd64 (single-user mode) Live Rescu> |
  | Ubuntu 10.04 LTS installer                                              |
+
  | centos5-64 rescue                                                      |
  |                                                                         |
+
  | centos5-64 install                                                      |
  |                                                                         |
+
  | centos6-64 rescue                                                      |
  |                                                                         |
+
  | centos6-64 install                                                      |
  |                                                                         |
+
  | centos7-64 rescue                                                      |
  |                                                                         |
+
  | centos7-64 install                                                      |
  |                                                                         |
+
  | debian-jessie-8.0-64 rescue                                            |
  |                                                                         |
+
  | debian-jessie-8.0-64 install                                            |
  |                                                                         |
+
  | debian-wheezy-7.0-64 rescue                                            | v
 
  +-------------------------------------------------------------------------+
 
  +-------------------------------------------------------------------------+
 
     Use the ^ and v keys to select which entry is highlighted.
 
     Use the ^ and v keys to select which entry is highlighted.
Line 69: Line 70:
 
     commands before booting, or 'c' for a command-line.
 
     commands before booting, or 'c' for a command-line.
 
</pre></li>
 
</pre></li>
<li>Choose CentOS rescue to boot the read only rescue image. When it is finished booting, login as root at the prompt with no password:
+
<li>Choose Debian GNU/Linux Live Rescue to boot the read only rescue image. When it is finished booting, login as root at the prompt with no password:
 
<pre>
 
<pre>
CentOS release 5.4 (Final)
+
Debian GNU/Linux 8 rescue hvc0
Kernel 2.6.18-164.6.1.el5xen on an x86_64
 
  
build.xen.prgmr.com login: root
+
rescue login: root
[root@build ~]#
+
Linux rescue 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64
 +
Documentation on installing a new image is at
 +
http://wiki.prgmr.com/mediawiki/index.php/Untarring_a_fresh_OS_image
 +
 
 +
To enable ssh access to the rescue image, copy
 +
your public key to /root/.ssh/authorized_keys and type
 +
"service ssh start"
 +
root@rescue:~#  
 
</pre></li>
 
</pre></li>
 
<li>Mount your root filesystem (by default /dev/xvda1) and chroot to it:
 
<li>Mount your root filesystem (by default /dev/xvda1) and chroot to it:
 
<pre>
 
<pre>
[root@build ~]# mount /dev/xvda1 /mnt
+
root@rescue:~# mount /dev/xvda1 /mnt
[root@build ~]# chroot /mnt
+
[ 330.620031] EXT4-fs (xvda1): mounting ext3 file system using the ext4 subsystem
build:/#
+
[  330.689992] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
 +
root@rescue:~# chroot /mnt
 +
[root@rescue /]#  
 
</pre></li>
 
</pre></li>
 
<li>Change the root password with passwd:
 
<li>Change the root password with passwd:
 
<pre>
 
<pre>
build:/# passwd
+
[root@rescue /]# passwd
 
Enter new UNIX password:  
 
Enter new UNIX password:  
 
Retype new UNIX password:  
 
Retype new UNIX password:  
 
passwd: password updated successfully
 
passwd: password updated successfully
build:/#
+
[root@rescue /]#  
 
</pre></li>
 
</pre></li>
 
<li>Exit, unmount, and shutdown:
 
<li>Exit, unmount, and shutdown:
 
<pre>
 
<pre>
build:/# exit
+
[root@rescue /]# exit
 
exit
 
exit
[root@build ~]# umount /mnt
+
root@rescue:~# umount /mnt
[root@build ~]# shutdown -h now
+
root@rescue:~# shutdown -h now
 
+
        Starting Synchronise Hardware Clock to System Clock...
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
 
 
</pre>
 
</pre>
 
</li>
 
</li>
<li>Start the domain again as in step 2, but let it load the "user bootloader configuration" instead of choosing the rescue image.</li>
+
<li>This will return you to the Management Console. Start the domain again as in step 2, but let it load the "user bootloader configuration" instead of choosing the rescue image.</li>
 
</ol>
 
</ol>
 
{{c|for Users}}
 
{{c|for Users}}
 
{{c|Prgmr}}
 
{{c|Prgmr}}

Revision as of 05:25, 11 March 2016

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 Management Console.
    Name                                        ID   Mem VCPUs	State	Time(s)
    cnrylefanu                                 159   256     1     -b----     131.6
    
        Wiki at http://wiki.prgmr.com
        Please contact support@prgmr.com with any issues accessing your machine.
    
        Options for "cnrylefanu"
        1. out of band console (press ctrl-] to escape, not resizeable)
        2. create/start, opens OOB console (try this if the machine is not running)
        3. shutdown (requests operating system to shut down)
        4. force power off (destroy/hard shutdown)
        5. reboot (requests operating system to reboot)
        6. swap i386/amd64 bootloaders currently "amd64"
        7. view/add/remove ssh authorized_keys
        8. set reverse dns
        9. swap pvgrub/grub2 bootloaders currently "pv-grub"
    
        0. exit
        enter selection> 3
    
    
    This will signal the domain to shut down safely.
  2. When the machine is stopped, the Management Console menu will return. Entering 3 again will generate a new menu with a different heading:
    Error: Domain 'build' does not exist.
    
    which is normal, it just means the vps isn't running. Choose create/start to start the vps:
    Domain cnrylefanu is not running.
    
        Wiki at http://wiki.prgmr.com
        Please contact support@prgmr.com with any issues accessing your machine.
    
        Options for "cnrylefanu"
        1. out of band console (press ctrl-] to escape, not resizeable)
        2. create/start, opens OOB console (try this if the machine is not running)
        3. shutdown (requests operating system to shut down)
        4. force power off (destroy/hard shutdown)
        5. reboot (requests operating system to reboot)
        6. swap i386/amd64 bootloaders currently "amd64"
        7. view/add/remove ssh authorized_keys
        8. set reverse dns
        9. swap pvgrub/grub2 bootloaders currently "pv-grub"
        0. exit
        enter selection> 2     
    

    The domain will start booting with pvgrub and will load the grub menu from the rescue image:

        GNU GRUB  version 0.97  (262144K lower / 0K upper memory)
    
     +-------------------------------------------------------------------------+
     | user bootloader configuration                                           |  
     | Debian GNU/Linux, kernel 3.16.0-4-amd64 Live Rescue                     |
     | Debian GNU/Linux, kernel 3.16.0-4-amd64 (single-user mode) Live Rescu>  |
     | centos5-64 rescue                                                       |
     | centos5-64 install                                                      |
     | centos6-64 rescue                                                       |
     | centos6-64 install                                                      |
     | centos7-64 rescue                                                       |
     | centos7-64 install                                                      |
     | debian-jessie-8.0-64 rescue                                             |
     | debian-jessie-8.0-64 install                                            |
     | debian-wheezy-7.0-64 rescue                                             | v
     +-------------------------------------------------------------------------+
        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 Debian GNU/Linux Live Rescue to boot the read only rescue image. When it is finished booting, login as root at the prompt with no password:
    Debian GNU/Linux 8 rescue hvc0
    
    rescue login: root
    Linux rescue 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64
    Documentation on installing a new image is at 
    http://wiki.prgmr.com/mediawiki/index.php/Untarring_a_fresh_OS_image
    
    To enable ssh access to the rescue image, copy
    your public key to /root/.ssh/authorized_keys and type
    "service ssh start"
    root@rescue:~# 
    
  4. Mount your root filesystem (by default /dev/xvda1) and chroot to it:
    root@rescue:~# mount /dev/xvda1 /mnt
    [  330.620031] EXT4-fs (xvda1): mounting ext3 file system using the ext4 subsystem
    [  330.689992] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
    root@rescue:~# chroot /mnt
    [root@rescue /]# 
    
  5. Change the root password with passwd:
    [root@rescue /]# passwd
    Enter new UNIX password: 
    Retype new UNIX password: 
    passwd: password updated successfully
    [root@rescue /]# 
    
  6. Exit, unmount, and shutdown:
    [root@rescue /]# exit
    exit
    root@rescue:~# umount /mnt
    root@rescue:~# shutdown -h now
             Starting Synchronise Hardware Clock to System Clock...
    
  7. This will return you to the Management Console. Start the domain again as in step 2, but let it load the "user bootloader configuration" instead of choosing the rescue image.