Difference between revisions of "Root Password Reset"

From PrgmrWiki
m (Srn moved page Password Reset to Root Password Reset: Password reset could refer to other systems)
 
(20 intermediate revisions by 2 users not shown)
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.  
+
The prgmr.com rescue image can be used to reset the root password for your VPS just as you might use a live CD. If you run BSD, you can also boot the appropriate BSD installer and follow a similar process.  
  
<ol>
+
=Boot Into Rescue Mode=
<li>If the vps (domain) is still running, shut it down using the [[Prgmr menu]].
+
Shut down your VPS and boot into the rescue mode using the [[Management Console]]:
<pre>
 
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
 
</pre> This will signal the domain to safely shutdown like the shutdown command.</li>
 
<li>When it is stopped running, opening the menu will say
 
 
<pre>
 
<pre>
Error: Domain 'build' does not exist.
+
Options:
</pre> which is normal, it just means the vps isn't running. Choose create to start the vps:
 
<pre>
 
 
 
Error: Domain 'build' does not exist.                                   
 
                                                                         
 
                                                                         
 
Options for build                                                       
 
 
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 clean shutdown, forces off after 4 min)
4. destroy/hard shutdown
+
4. force power off (destroy/hard shutdown)
5. reboot
+
5. reboot (shutdown + start)
6. swap i386/amd64 bootloaders (pvgrub) currently i386
+
6. set bootloader, rescue mode, or netboot installer
 
7. view/add/remove ssh authorized_keys
 
7. view/add/remove ssh authorized_keys
8. set reverse dns
+
8. view/edit reverse dns
9. exit
+
9. install new OS image
press the number> 2   
+
a. system details
 +
b. maintenance options
 
</pre>
 
</pre>
The domain will start booting with pvgrub and will load the grub menu from the rescue image:
+
 
 +
<li>Select "system details" and note what "Boot option:" says. Normally this will be set to "Disk".</li>
 +
<li>Select "shutdown" to shut down your VPS.</li>
 +
 
 +
When the system shuts down and returns to the console, use option "set bootloader, rescue mode, or netboot installer" and proceed from there. Depending on your VPS type, you will be presented with one of two menus:
 +
 
 
<pre>
 
<pre>
   
+
Options:
    GNU GRUB  version 0.97  (1048576K lower / 0K upper memory)
+
1. Boot from disk
+
2. Linux-based Live Rescue
+-------------------------------------------------------------------------+
+
3. Linux netboot installers - install mode
| user bootloader configuration                                          | 
+
4. Linux netboot installers - rescue mode
| CentOS 5.5 rescue (2.6.18-194.3.1.el5xen)                              |
+
5. BSD installers
| CentOS 5.5 installer                                                    |
+
</pre>
| Ubuntu 10.04 LTS installer                                              |
+
 
|                                                                        |
+
or
|                                                                        |
+
 
|                                                                        |
 
|                                                                        |
 
|                                                                        |
 
|                                                                        |
 
|                                                                        |
 
|                                                                        |
 
+-------------------------------------------------------------------------+
 
    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>
 
<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:
 
 
<pre>
 
<pre>
CentOS release 5.4 (Final)
+
Options:
Kernel 2.6.18-164.6.1.el5xen on an x86_64
+
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
 +
</pre>
 +
 
 +
<li>Select Linux-based Live Rescue if you run Linux, otherwise choose the appropriate BSD installer.</li>
 +
 
 +
<li>Go back to the main menu and select "create/start".</li>
  
build.xen.prgmr.com login: root
+
==Reset Your Password==
[root@build ~]#
+
<ol>
</pre></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>
<li>Mount your root filesystem (by default /dev/xvda1) and chroot to it:
 
 
<pre>
 
<pre>
[root@build ~]# mount /dev/xvda1 /mnt
+
rescue login: root
[root@build ~]# chroot /mnt
+
Linux rescue 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64
build:/#
+
To manually enable ssh access to the rescue image, copy
</pre></li>
+
your public key to /root/.ssh/authorized_keys and type
<li>Change the root password with passwd:
+
"service ssh start"
 +
root@rescue:~#  
 +
</pre>
 +
<li>Mount your root filesystem (by default /dev/xvda1) and chroot to it:</li>
 
<pre>
 
<pre>
build:/# passwd
+
root@rescue:~# mount /dev/xvda1 /mnt/
 +
[  60.024137] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
 +
root@rescue:~# chroot /mnt/
 +
</pre>
 +
<li>Change the root password with passwd:</li>
 +
<pre>
 +
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:/#
+
</pre>
</pre></li>
+
 
<li>Exit, unmount, and shutdown:
+
<li>If you are using CentOS or Fedora, mark the file system for [https://wiki.centos.org/HowTos/SELinux#Relabel_Complete_Filesystem selinux autorelabeling]:</li>
 +
<pre>
 +
root@rescue:/# touch /.autorelabel
 +
</pre>
 +
 
 +
<li>Exit, unmount, and shutdown:</li>
 
<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>This will return you to the Management Console. You need to set the system to boot normally again. Go to the "set bootloader, rescue mode, or netboot installer" menu and select your original boot option.</li>
<li>Start the vps again as in step 2, but let it load the vps instead of choosing the rescue image.</li>
+
<li>Go back to the main menu.</li>
 +
<li>Start the VPS again using "create/start."</li>
 
</ol>
 
</ol>
 
{{c|for Users}}
 
{{c|for Users}}
 
{{c|Prgmr}}
 
{{c|Prgmr}}

Latest revision as of 19:01, 19 May 2020

The prgmr.com rescue image can be used to reset the root password for your VPS just as you might use a live CD. If you run BSD, you can also boot the appropriate BSD installer and follow a similar process.

Boot Into Rescue Mode

Shut down your VPS and boot into the rescue mode using the Management Console:

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, rescue mode, or netboot installer
7. view/add/remove ssh authorized_keys
8. view/edit reverse dns
9. install new OS image
a. system details
b. maintenance options
  • Select "system details" and note what "Boot option:" says. Normally this will be set to "Disk".
  • Select "shutdown" to shut down your VPS.
  • When the system shuts down and returns to the console, use option "set bootloader, rescue mode, or netboot installer" and proceed from there. Depending on your VPS type, you will be presented with one of two menus:

    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
    

    or

    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
    
  • Select Linux-based Live Rescue if you run Linux, otherwise choose the appropriate BSD installer.
  • Go back to the main menu and select "create/start".
  • 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. rescue login: root
      Linux rescue 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64
      To manually 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/
      [   60.024137] EXT4-fs (xvda1): mounted filesystem with ordered data mode. Opts: (null)
      root@rescue:~# chroot /mnt/
      
    5. Change the root password with passwd:
    6. root@rescue:/# passwd
      Enter new UNIX password: 
      Retype new UNIX password: 
      passwd: password updated successfully
      
    7. If you are using CentOS or Fedora, mark the file system for selinux autorelabeling:
    8. root@rescue:/# touch /.autorelabel
      
    9. Exit, unmount, and shutdown:
    10. [root@rescue /]# exit
      exit
      root@rescue:~# umount /mnt
      root@rescue:~# shutdown -h now
               Starting Synchronise Hardware Clock to System Clock...
      
    11. This will return you to the Management Console. You need to set the system to boot normally again. Go to the "set bootloader, rescue mode, or netboot installer" menu and select your original boot option.
    12. Go back to the main menu.
    13. Start the VPS again using "create/start."