{"id":2888,"date":"2015-12-31T22:25:08","date_gmt":"2015-12-31T22:25:08","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=2888"},"modified":"2015-12-31T22:25:08","modified_gmt":"2015-12-31T22:25:08","slug":"reset-centos-root-password","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2015\/12\/31\/reset-centos-root-password\/","title":{"rendered":"Reset CentOS Root Password"},"content":{"rendered":"<p>To reset the root password for CentOS 6:<\/p>\n<p>Boot Computer and Interrupt while booting at GRUB stage hitting \u2018arrow\u2018 keys or \u201cspace bar\u201c.<br \/>\nType \u2018a\u2018 to modify kernel argument. Anytime you can cancel typing \u2018ESC\u2018 key.<br \/>\nAppend 1 at the end of \u201crhgb quiet\u201d and press \u201cEnter\u201d key to boot into single user mode.<br \/>\nType command \u201crunlevel\u201d to know the the runlevel where you are standing. Here \u201c1 S\u201d state that your are in a single user mode.<br \/>\nType \u2018passwd\u2018 command without username and press \u2018Enter\u2018 key in command prompt. It\u2019ll ask to supply new root password and re-type the same password for confirmation.<\/p>\n<p>Reboot<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# shutdown -r now\n<\/pre>\n<p>CentOS 7<\/p>\n<p>At the boot menu, press e to edit the existing kernel (Core) <\/p>\n<p>Next, scroll down to the list until you see the line underlined below ( ro ) . What we need to do is change that ro to rw and start into a bash shell. It should look like this rw init=\/sysroot\/bin\/sh.<\/p>\n<p>Change the ro line to rw and add init=\/sysroot\/bin\/sh<\/p>\n<p>After changing that, press Control + X  or Ctrl + X  on your keyboard to start into single user mode using the bash shell specified above. In this mode, we\u2019re going to change the root password.<\/p>\n<p>In the single user mode, run the command as shown below<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# chroot \/sysroot\n\n<\/pre>\n<p>Finally, run the commands below to change the root password.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# passwd root\n\n<\/pre>\n<p>You\u2019ll be prompted to create and confirm a new password.  After creating the password, run the commands below to update SELinux parameters<\/p>\n<p>touch \/.autorelabel<\/p>\n<p>Reboot<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To reset the root password for CentOS 6: Boot Computer and Interrupt while booting at GRUB stage hitting \u2018arrow\u2018 keys or \u201cspace bar\u201c. Type \u2018a\u2018 to modify kernel argument. Anytime you can cancel typing \u2018ESC\u2018 key. Append 1 at the end of \u201crhgb quiet\u201d and press \u201cEnter\u201d key to boot into single user mode. Type &#8230; <a title=\"Reset CentOS Root Password\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2015\/12\/31\/reset-centos-root-password\/\" aria-label=\"Read more about Reset CentOS Root Password\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-2888","post","type-post","status-publish","format-standard","hentry","category-administration","category-centos6","category-centos-7"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=2888"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2888\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=2888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=2888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=2888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}