{"id":634,"date":"2019-12-23T20:11:42","date_gmt":"2019-12-23T20:11:42","guid":{"rendered":"https:\/\/server-help.org\/?p=634"},"modified":"2019-12-23T20:11:42","modified_gmt":"2019-12-23T20:11:42","slug":"recover-reset-root-password-in-rescue","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2019\/12\/23\/recover-reset-root-password-in-rescue\/","title":{"rendered":"Recover \/ Reset root Password in Rescue"},"content":{"rendered":"\n<p>In previous articles <a rel=\"noreferrer noopener\" aria-label=\"Recovering the Root Password (RHEL \/ CentOS 7) (opens in a new tab)\" href=\"https:\/\/server-help.org\/index.php\/2018\/11\/27\/recovering-the-root-password\/\" target=\"_blank\">Recovering the Root Password (RHEL \/ CentOS 7)<\/a> and <a rel=\"noreferrer noopener\" aria-label=\"Recovering the Root Password (Ubuntu) (opens in a new tab)\" href=\"https:\/\/server-help.org\/index.php\/2018\/11\/27\/recovering-the-root-password-ubuntu\/\" target=\"_blank\">Recovering the Root Password (Ubuntu)<\/a> was how to Recover \/ Reset root Password from the Kernel.<\/p>\n\n\n\n<p>In this guide, we will provide Information how to Recover \/ Reset root Password for any Server (Cloud, Dedicated) in Rescue mode.<\/p>\n\n\n\n<p>Boot your Server into Rescue; if your Server is Cloud Server or Cloud VPS, we would recommend use Knoppix. If your Server is Dedicated, then just reboot Server with the available Rescue option you have.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1- Recover root Password (Cloud Server, Dynamic Cloud Server)<\/h3>\n\n\n\n<p>After booting your Server into Rescue using Knoppix, you need to access your Server with the provided Emulator (KVM, VNC)<\/p>\n\n\n\n<p>First, switch to root user, &#8220;this is not your Server root, it&#8217;s Knoppix root user&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># sudo su -<\/code><\/pre>\n\n\n\n<p>Then, either to activate the SSH Service in order to use your SSH Client (MobaXterm, Putty), or you can proceed with the steps from (KVM, VNC).<\/p>\n\n\n\n<p>If you would like to use your SSH Client, then you need to set password for Knoppix root user, after that you can access your Server using your SSH Client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># passwd root<\/code><\/pre>\n\n\n\n<p>Please refer to <a rel=\"noreferrer noopener\" aria-label=\"How to mount Cloud \/ VPS Cloud in Rescue (opens in a new tab)\" href=\"https:\/\/server-help.org\/index.php\/2019\/05\/13\/unable-to-mount-lvm2_member\/\" target=\"_blank\">How to mount Cloud \/ VPS Cloud in Rescue<\/a> to Activate your Logical Volume and mount to \/mnt Directory.<\/p>\n\n\n\n<p>After mounting your Logical Volume to \/mnt Directory, you need to mount the following system files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mount --bind \/dev \/mnt\/dev\n# mount --bind \/dev\/pts \/mnt\/dev\/pts\n# mount --bind \/proc \/mnt\/proc\n# mount --bind \/sys \/mnt\/sys<\/code><\/pre>\n\n\n\n<p>Then, chroot \/mnt, once you chroot \/mnt, you are can then proceed as if you were working with your usual server configuration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># chroot \/mnt<\/code><\/pre>\n\n\n\n<p>Then proceed with changing your root Password:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># passwd\nEnter new UNIX password:\nRetype new UNIX password:\npasswd: password updated successfully<\/code><\/pre>\n\n\n\n<p>Then exit chroot, and unmount file systems, then reboot Server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># exit\n# umount -a\n# reboot<\/code><\/pre>\n\n\n\n<p>Eject Knoppix DVD, and now you can access your Server using your new Password.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> 2- Recover root Password on other Servers<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">&#8211; Dedicated Servers<\/h4>\n\n\n\n<p>After booting your Server into Rescue, access your Server either via Serial Console, or normal SSH, then you need to check your Server Disks and Partitions with fdisk command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># fdisk -l\n\nDisk \/dev\/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk label type: dos\nDisk identifier: 0x76a7d556\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1            2048     8390655     4194304   fd  Linux raid autodetect\n\/dev\/sdb2         8390656    12584959     2097152   82  Linux swap \/ Solaris\n\/dev\/sdb3        12584960  1953525167   970470104   fd  Linux raid autodetect\n\nDisk \/dev\/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk label type: dos\nDisk identifier: 0x76a7d556\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1            2048     8390655     4194304   fd  Linux raid autodetect\n\/dev\/sda2         8390656    12584959     2097152   82  Linux swap \/ Solaris\n\/dev\/sda3        12584960  1953525167   970470104   fd  Linux raid autodetect\n\nDisk \/dev\/md3: 993.8 GB, 993761296384 bytes, 1940940032 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\n\n\nDisk \/dev\/md1: 4294 MB, 4294901760 bytes, 8388480 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\n\n\nDisk \/dev\/mapper\/vg00-usr: 5368 MB, 5368709120 bytes, 10485760 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\n\n\nDisk \/dev\/mapper\/vg00-var: 112.7 GB, 112742891520 bytes, 220200960 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\n\n\nDisk \/dev\/mapper\/vg00-home: 5368 MB, 5368709120 bytes, 10485760 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/code><\/pre>\n\n\n\n<p>With having \/dev\/md1 and \/dev\/md3 then, you need check your RAID in order to determine which drive has sda1:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cat \/proc\/mdstat\nPersonalities : &#91;raid1]\nmd1 : active raid1 sdb1&#91;1] sda1&#91;0]\n      4194240 blocks &#91;2\/2] &#91;UU]\n\nmd3 : active raid1 sdb3&#91;1] sda3&#91;0]\n      970470016 blocks &#91;2\/2] &#91;UU]<\/code><\/pre>\n\n\n\n<p>So, we mount \/dev\/md1, because it contains the file system we need:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mount \/dev\/md1 \/mnt\n# mount \/dev\/mapper\/vg00-var \/mnt\/var\n# mount \/dev\/mapper\/vg00-usr \/mnt\/usr\n# mount \/dev\/mapper\/vg00-home \/mnt\/home\n# mount --bind \/dev \/mnt\/dev\n# mount --bind \/dev\/pts \/mnt\/dev\/pts\n# mount --bind \/proc \/mnt\/proc\n# mount --bind \/sys \/mnt\/sys<\/code><\/pre>\n\n\n\n<p>Then, chroot \/mnt, once you chroot \/mnt, you are can then proceed as if you were working with your usual server configuration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># chroot \/mnt<\/code><\/pre>\n\n\n\n<p>Then proceed with changing your root Password:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># passwd\nEnter new UNIX password:\nRetype new UNIX password:\npasswd: password updated successfully<\/code><\/pre>\n\n\n\n<p>Then exit chroot, and unmount file systems, then reboot Server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># exit\n# umount -a\n# reboot<\/code><\/pre>\n\n\n\n<p>Boot your Server back to Local, and now you can access your Server using your new Password.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In previous articles Recovering the Root Password (RHEL \/ CentOS 7) and Recovering the Root Password (Ubuntu) was how to Recover \/ Reset root Password from the Kernel. In this guide, we will provide Information how to Recover \/ Reset root Password for any Server (Cloud, Dedicated) in Rescue mode. Boot your Server into Rescue;&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/634"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=634"}],"version-history":[{"count":3,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/634\/revisions"}],"predecessor-version":[{"id":637,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/634\/revisions\/637"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}