Difference between revisions of "Root Password Reset"

From PrgmrWiki
(Reset Your Password)
Line 1: Line 1:
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.
+
_FORCETOC_
  
==Set Up Your VPS==
+
The prgmr.com rescue image can be used to reset the root password for your VPS just as you might use 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.
 +
 
 +
=Boot Into Rescue Mode=
 +
Shut down your VPS and boot into the rescue mode using the [[Management Console]]. The procedure varies slightly depending on which version of the console you have.
 +
 
 +
==Latest Management Console==
 +
In the [[Management Console#Latest Management Console|latest management console]] you can boot directly into the rescue mode.
 +
 
 +
<pre>
 +
Options:
 +
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 clean shutdown, forces off after 4 min)
 +
4. force power off (destroy/hard shutdown)
 +
5. reboot (shutdown + start)
 +
6. set bootloader or rescue mode
 +
7. view/add/remove ssh authorized_keys
 +
8. view/edit reverse dns
 +
9. install new OS image
 +
a. system details
 +
 
 +
0. Exit
 +
R. refresh
 +
 
 +
enter selection>
 +
</pre>
 +
 
 +
Enter option 6 and proceed from there according to whether you are running hardware virtualization (HVM) or paravirtualization (PV).
 +
 
 +
=== Boot options - HVM ===
 +
In HVM systems, pressing option 6 will bring up the following menu:
  
To access the live rescue image more easily, verify that you are using "pv-grub", using the [[Management Console]]. Check option 9.
+
<pre>
 +
Set Boot Options - nite
 +
 
 +
Configured to boot from disk.
 +
 
 +
Options:
 +
1. Boot from disk
 +
2. Linux-based Live Rescue
 +
3. Linux netboot installers - install mode
 +
4. Linux netboot installers - rescue mode
 +
5. BSD installers
 +
 
 +
0. Return to main menu
 +
R. refresh
 +
 
 +
enter selection>
 +
</pre>
 +
 
 +
=== Boot options - Paravirtualized ===
 +
In PV systems, pressing option 6 will bring up the following menu:
 +
<pre>
 +
Set Boot Options - nite
 +
 
 +
Configured to boot 'PV-GRUB - 64 bit' with arguments '(hd0,0)/boot/grub/menu.lst'
 +
 
 +
Options:
 +
1. GRUB legacy(pv-grub)
 +
2. GRUB2
 +
3. Linux-based Live Rescue
 +
4. Linux netboot installers - install mode
 +
5. Linux netboot installers - rescue mode
 +
6. BSD netboot installers
 +
 
 +
0. Return to main menu
 +
R. refresh
 +
 
 +
enter selection>
 +
</pre>
 +
 
 +
Select Linux-based Live Rescue, Linux netboot installers - rescue mode, or BSD installers, depending on your system. When your rescue image boots, proceed to [[#Reset Your Password]].
 +
 
 +
==Legacy Management Console==
 +
 
 +
To access the live rescue image more easily, verify that you are using "pv-grub", using the [[Management Console#Legacy Management Console|latest management console]]. Check option 9.
 
<pre>
 
<pre>
 
Name                                        ID  Mem VCPUs State Time(s)
 
Name                                        ID  Mem VCPUs State Time(s)
Line 35: Line 108:
 
==Reset Your Password==
 
==Reset Your Password==
 
<ol>
 
<ol>
<li>If the vps (domain) is still running, enter option 3 to shut it down safely.<p>When the machine is stopped, the Management Console menu will return. Pressing Enter will generate a new menu with a different heading:</p></li>
+
<li>When the rescue image is finished booting, log in as root at the prompt with no password (this example uses the Linux-based Live Rescue):</li>
<pre>
 
Domain 'cnryfield' is not running.</pre>
 
<li>Choose option 2 (create/start) to start the vps.<p>The domain will start booting with pvgrub and will load the grub menu from the rescue image:</p></li>
 
<pre>
 
GNU GRUB  version 0.97  (131072K lower / 0K upper memory)
 
+-------------------------------------------------------------------------+
 
| user bootloader configuration                                          | 
 
| Debian GNU/Linux, kernel 3.2.0-4-amd64 Live Rescue                      |
 
| Debian GNU/Linux, kernel 3.2.0-4-amd64 (single-user mode) Live Rescue  |
 
| ubuntu-trusty-14.04-64 rescue                                          |
 
| ubuntu-trusty-14.04-64 install                                          |
 
| centos5-64 rescue                                                      |
 
| centos5-64 install                                                      |
 
| debian-wheezy-7.0-64 rescue                                            |
 
| debian-wheezy-7.0-64 install                                            |
 
| fedora20-64 rescue                                                      |
 
| fedora20-64 install                                                    |
 
| centos6-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.</pre>
 
<li>Choose Debian GNU/Linux Live Rescue to boot the read only rescue image. When it is finished booting, log in as root at the prompt with no password:</li>
 
 
<pre>
 
<pre>
 
Debian GNU/Linux 8 rescue hvc0
 
Debian GNU/Linux 8 rescue hvc0
Line 93: Line 143:
 
         Starting Synchronise Hardware Clock to System Clock...
 
         Starting Synchronise Hardware Clock to System Clock...
 
</pre>
 
</pre>
<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>
+
<li>This will return you to the Management Console. To start the domain select Option 6. If you are running HVM then select "Boot from disk". For PV select "GRUB legacy(pv-grub)" or "GRUB2", as you prefer.</li>
 
</ol>
 
</ol>
 
{{c|for Users}}
 
{{c|for Users}}
 
{{c|Prgmr}}
 
{{c|Prgmr}}

Revision as of 22:49, 18 September 2016

_FORCETOC_

The prgmr.com rescue image can be used to reset the root password for your VPS just as you might use 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.

Boot Into Rescue Mode

Shut down your VPS and boot into the rescue mode using the Management Console. The procedure varies slightly depending on which version of the console you have.

Latest Management Console

In the latest management console you can boot directly into the rescue mode.

Options:
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 clean shutdown, forces off after 4 min)
4. force power off (destroy/hard shutdown)
5. reboot (shutdown + start)
6. set bootloader or rescue mode
7. view/add/remove ssh authorized_keys
8. view/edit reverse dns
9. install new OS image
a. system details

0. Exit
R. refresh

enter selection>

Enter option 6 and proceed from there according to whether you are running hardware virtualization (HVM) or paravirtualization (PV).

Boot options - HVM

In HVM systems, pressing option 6 will bring up the following menu:

Set Boot Options - nite

Configured to boot from disk.

Options:
1. Boot from disk
2. Linux-based Live Rescue
3. Linux netboot installers - install mode
4. Linux netboot installers - rescue mode
5. BSD installers

0. Return to main menu
R. refresh

enter selection>

Boot options - Paravirtualized

In PV systems, pressing option 6 will bring up the following menu:

Set Boot Options - nite

Configured to boot 'PV-GRUB - 64 bit' with arguments '(hd0,0)/boot/grub/menu.lst'

Options:
1. GRUB legacy(pv-grub)
2. GRUB2
3. Linux-based Live Rescue
4. Linux netboot installers - install mode
5. Linux netboot installers - rescue mode
6. BSD netboot installers

0. Return to main menu
R. refresh

enter selection>

Select Linux-based Live Rescue, Linux netboot installers - rescue mode, or BSD installers, depending on your system. When your rescue image boots, proceed to #Reset Your Password.

Legacy Management Console

To access the live rescue image more easily, verify that you are using "pv-grub", using the latest management console. Check option 9.

Name                                        ID   Mem VCPUs	State	Time(s)
cnryfield                                  218  1024     1     r-----    1898.8

    Wiki at http://wiki.prgmr.com
    Please contact support@prgmr.com with any issues accessing your machine.

    Options for "cnryfield"
    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 "i386"
    7. view/add/remove ssh authorized_keys
    8. set reverse dns
    9. swap pvgrub/grub2 bootloaders currently "pv-grub"

    0. exit
    enter selection> 

If the current bootloader is grub2, press 9 to switch to pv-grub.

Check whether you are running in 32 bit (i386) or 64 bit (amd64) mode by looking at option 6:

6. swap i386/amd64 bootloaders currently "i386"

and switch if desired.

Reset Your Password

  1. When the rescue image is finished booting, log in as root at the prompt with no password (this example uses the Linux-based Live Rescue):
  2. 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:~#
  3. Mount your root filesystem (by default /dev/xvda1) and chroot to it:
  4. 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:
  6. [root@rescue /]# passwd
    Enter new UNIX password: 
    Retype new UNIX password: 
    passwd: password updated successfully
    [root@rescue /]# 
  7. Exit, unmount, and shutdown:
  8. [root@rescue /]# exit
    exit
    root@rescue:~# umount /mnt
    root@rescue:~# shutdown -h now
             Starting Synchronise Hardware Clock to System Clock...
    
  9. This will return you to the Management Console. To start the domain select Option 6. If you are running HVM then select "Boot from disk". For PV select "GRUB legacy(pv-grub)" or "GRUB2", as you prefer.