{"id":6159,"date":"2016-08-07T15:53:16","date_gmt":"2016-08-07T07:53:16","guid":{"rendered":"http:\/\/rmohan.com\/?p=6159"},"modified":"2016-08-07T15:53:16","modified_gmt":"2016-08-07T07:53:16","slug":"reset-rhel7-root-password","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6159","title":{"rendered":"Reset rhel7 root password"},"content":{"rendered":"<h3 class=\"post-title entry-title\">Reset rhel7 root password<\/h3>\n<div dir=\"ltr\">\u00a0In the RHCSA examination they ask to reset the root password, In this article we are going to learn how to reset rhel7 root user password.<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">\n<a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/root_password_forgot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6161\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/root_password_forgot.png\" alt=\"root_password_forgot\" width=\"320\" height=\"223\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/root_password_forgot.png 320w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/root_password_forgot-300x209.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/root_password_forgot-150x105.png 150w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">Whenever you type user password incorrectly it will shown an above error.<\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/restart-rhel7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6160\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/restart-rhel7.png\" alt=\"restart rhel7\" width=\"292\" height=\"170\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/restart-rhel7.png 292w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/restart-rhel7-150x87.png 150w\" sizes=\"(max-width: 292px) 100vw, 292px\" \/><\/a><\/div>\n<div dir=\"ltr\">Immediate After Right side of the corner there is a power button Click on that power button and Click on Restart Server. Server will restart.<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/Select-Kernel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6162\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/Select-Kernel.png\" alt=\"Select Kernel\" width=\"320\" height=\"149\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/Select-Kernel.png 320w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/Select-Kernel-300x140.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/Select-Kernel-150x70.png 150w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/div>\n<div dir=\"ltr\">While restarting of server you have to press any key to stop the OS booting process yet the stage of Kernel. As shown in above screen shot kernel line will stop. Then Press &#8216;e&#8217;<\/p>\n<p>After pressing key &#8216;e&#8217; then kernel lines will be edited. As shown in below screenshot<\/p><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/rd.break-console.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6163\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/rd.break-console.png\" alt=\"rd.break console\" width=\"400\" height=\"179\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/rd.break-console.png 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/rd.break-console-300x134.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/rd.break-console-150x67.png 150w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">if you see there is a line start with &#8220;linux16&#8221; go to that line press &#8216;END&#8217; key to go last of the line. In END of the line write &#8220;rd.break console=tty1&#8221; (without quotations). Then Press CTRL+x<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">Server will go to Single user mode. As shown in above screen shot.<br \/>\nIn this mode \/sysroot file system bill be mounted as ReadOnly. We have to make \/sysroot as ReadWrite then only we can able to change the password.<\/p>\n<p>Changing password means we are indirectly writing the encrypted password in \/etc\/shadow file.<\/p><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/reset-rhel7-root-password.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6164\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/reset-rhel7-root-password.png\" alt=\"reset rhel7 root password\" width=\"400\" height=\"133\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/reset-rhel7-root-password.png 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/reset-rhel7-root-password-300x100.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/reset-rhel7-root-password-150x50.png 150w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">To mount \/sysroot file system in ReadWrite run below command<br \/>\n# mount -o remount,rw \/sysroot<\/p>\n<p>Now change to root using below command<br \/>\n#chroot \/sysroot<\/p>\n<p>Now prompt will be changed to Shell.<br \/>\n# passwd<br \/>\nNew Password: redhat<br \/>\nRetype Password: redhat<\/p>\n<p>Now root password has been changed to &#8216;redhat&#8217;. If you reboot the server will not come back. in RHEL7 by default SELinux is in enforced mode we have to relabel the SELinux inorder to bring back the server in Normal Stage.<\/p>\n<p>To Relabel the SELinux run below command<br \/>\n# touch \/.autorelabel<\/p><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/autorelabel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6165\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/autorelabel.png\" alt=\"autorelabel\" width=\"400\" height=\"71\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/autorelabel.png 400w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/autorelabel-300x53.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/autorelabel-150x27.png 150w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/switch_root.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6166\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/08\/switch_root.png\" alt=\"switch_root\" width=\"320\" height=\"83\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/switch_root.png 320w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/switch_root-300x78.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/08\/switch_root-150x39.png 150w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Reset rhel7 root password In the RHCSA examination they ask to reset the root password, In this article we are going to learn how to reset rhel7 root user password. Whenever you type user password incorrectly it will shown an above error. Immediate After Right side of the corner there is a power button Click [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6159"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6159"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6159\/revisions"}],"predecessor-version":[{"id":6167,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6159\/revisions\/6167"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}