{"id":1024,"date":"2016-07-14T19:55:19","date_gmt":"2016-07-14T19:55:19","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=1024"},"modified":"2016-07-14T19:55:19","modified_gmt":"2016-07-14T19:55:19","slug":"punishment-for-laziness-root-password-recovery","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2016\/07\/14\/punishment-for-laziness-root-password-recovery\/","title":{"rendered":"Punishment for laziness &#8211; root password recovery"},"content":{"rendered":"<p>I had a new idea for adding one more computer to my life. \u00a0The task was to actually provide some fun new functionality to my family and I attacked the task.<\/p>\n<p>At the beginning, I needed to log in as root fairly often to get Apache setup and configured as well as some of my own customization&#8217;s. \u00a0Because of this, all the passwords were at the tip of my fingers. \u00a0My customization&#8217;s got better and better so eventually I rarely logged into the computer at all, not as root, nor even as a normal user.<\/p>\n<p>One day I actually did need to log in as the root user only to discover that I couldn&#8217;t remember the password. \u00a0There was no fear, as I normally have all my passwords in a password safe.<\/p>\n<p>Well, I must have been distracted when setting up that computer because I failed to write down any of the information. \u00a0This pretty much left me with a few options<\/p>\n<ol>\n<li>the application is fine, just use it and never change it<\/li>\n<li>copy my configuration and scripts and re-setup the computer<\/li>\n<li>find a way to reset the root password<\/li>\n<\/ol>\n<p>I had to do this once before for a Linux Mint computer that I setup. \u00a0I was hoping that these instructions would do the trick. \u00a0This time it was a Debian (8.2) system. \u00a0The method to do this is really easy.<\/p>\n<p><a href=\"http:\/\/www.debianadmin.com\/how-to-reset-debian-root-password.html\" target=\"_blank\">Attempt #1<\/a><\/p>\n<ol>\n<li>change kernal parameters from grub to boot to a shell<\/li>\n<li>change the password<\/li>\n<\/ol>\n<p>For some reason, when I did this with this machine the prompt would come up and then the machine would hang. \u00a0I wanted to do a quick update to ensure that everything was up to date but didn&#8217;t have the root password.<\/p>\n<p><a href=\"http:\/\/www.linuxforums.org\/forum\/linux-tutorials-howtos-reference-material\/54418-howto-recover-reset-root-password.html\" target=\"_blank\">Attempt #2<\/a><\/p>\n<ol>\n<li>change kernel parameters for group to boot to single user mode<\/li>\n<li>use passwd to change the password<\/li>\n<\/ol>\n<p>I was experiencing the same difficulties with this option as experienced with the first attempt. \u00a0The machine would boot to single user mode and hang.<\/p>\n<p><a href=\"http:\/\/www.linuxforums.org\/forum\/linux-tutorials-howtos-reference-material\/54418-howto-recover-reset-root-password.html\" target=\"_blank\">Attempt #3<\/a><\/p>\n<ol>\n<li>boot with a live disk<\/li>\n<li>mount root\u00a0partition<\/li>\n<li>change shadow file<\/li>\n<\/ol>\n<p>Despite the supposed difficulty of this option, there really is nothing to it. \u00a0The only problems that this computer system was sitting in the corner <a href=\"https:\/\/en.wikipedia.org\/wiki\/Headless_software\" target=\"_blank\">headless<\/a>. \u00a0This doesn&#8217;t really increase the difficulty of the task other than the additional effort of moving the computer and connecting up the accessories.<\/p>\n<p>This computer is actually just a tiny one with no CD\/DVD rom drive. \u00a0Thus the task was slightly changed to the following.<\/p>\n<ol>\n<li>download a live image<\/li>\n<li><a href=\"http:\/\/blog.paranoidprofessor.com\/index.php\/2016\/01\/20\/booting-linux-from-a-usb-stick\/\" target=\"_blank\">create bootable USB stick<\/a><\/li>\n<li>boot computer from USB stick<\/li>\n<li>mount root\u00a0partition<\/li>\n<li>change shadow file<\/li>\n<\/ol>\n<p>The description of how to actually reset the root password via the shadow file is really well described in a lot of places, but the site that I used was<\/p>\n<p><a href=\"http:\/\/www.linuxforums.org\/forum\/linux-tutorials-howtos-reference-material\/54418-howto-recover-reset-root-password.html\" target=\"_blank\">http:\/\/www.linuxforums.org\/forum\/linux-tutorials-howtos-reference-material\/54418-howto-recover-reset-root-password.html<\/a><\/p>\n<p>You only need to change the line for the root user in the shadow file and don&#8217;t need to do anything with the password file. \u00a0In the tutorial the password is reset to nothing, so you do need to make sure that this server is not reachable by anyone else during this critical time.<\/p>\n<p>I did find one more interesting method that could be used to reset the password.<\/p>\n<p><a href=\"http:\/\/www.microhowto.info\/howto\/reset_a_forgotten_root_password_using_a_live_distribution.html\" target=\"_blank\">Runner up<\/a><\/p>\n<ol>\n<li>boot a live disk<\/li>\n<li>mount the root\u00a0partition<\/li>\n<li>chroot to disk<\/li>\n<li>use passwd to change password of root user<\/li>\n<\/ol>\n<p>This also would have been a pretty simple option but I\u00a0was a bit concerned that the distribution that was being booted didn&#8217;t match the one that was installed.<\/p>\n<p>&nbsp;<\/p>\n<p>It was a very interesting\u00a0evening but actually it should be considered more of a punishment for failing to keep better track of a system that I\u00a0setup.<\/p>\n<p><strong>This should also serve as a object lesson that security. \u00a0If someone else has\u00a0unlimited access to the physical computer it is no longer secure.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a new idea for adding one more computer to my life. \u00a0The task was to actually provide some fun new functionality to my family and I attacked the task. At the beginning, I needed to log in as &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2016\/07\/14\/punishment-for-laziness-root-password-recovery\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[17,61],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/1024"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=1024"}],"version-history":[{"count":3,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/1024\/revisions"}],"predecessor-version":[{"id":1028,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/1024\/revisions\/1028"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=1024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=1024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=1024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}