{"id":6084,"date":"2016-07-29T09:00:51","date_gmt":"2016-07-29T01:00:51","guid":{"rendered":"http:\/\/rmohan.com\/?p=6084"},"modified":"2016-07-29T09:00:51","modified_gmt":"2016-07-29T01:00:51","slug":"single-user-mode-is-password-protected-by-the-root-password-on-rhel-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6084","title":{"rendered":"Single User mode is password protected by the root password on RHEL 7"},"content":{"rendered":"<p># RHEL 5<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># To force users to enter password in Single User mode, add following line to \/etc\/inittab:<\/p>\n<p>~:S:respawn:\/sbin\/sulogin<\/p>\n<p># The changes to this file takes effect after a system reboot<\/p>\n<p># To make init re-read the \/etc\/inittab without rebooting the system, type the command<\/p>\n<p>\/sbin\/init q<\/p>\n<p># RHEL 6<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># Edit \/etc\/inittab and add &#8220;su:S:wait:\/sbin\/sulogin&#8221; before &#8216;initdefault&#8217; line:<\/p>\n<p>vi \/etc\/inittab<br \/>\n   [&#8230;]<br \/>\n   su:S:wait:\/sbin\/sulogin<br \/>\n   id:3:initdefault:<\/p>\n<p># Edit \/etc\/sysconfig\/init and replace &#8220;SINGLE=\/sbin\/sushell&#8221;  with &#8220;SINGLE=\/sbin\/sulogin&#8221;:<\/p>\n<p>vi \/etc\/sysconfig\/init<br \/>\n   [&#8230;]<br \/>\n   # Set to &#8216;\/sbin\/sulogin&#8217; to prompt for password on single-user mode<br \/>\n   # Set to &#8216;\/sbin\/sushell&#8217; otherwise<br \/>\n   SINGLE=\/sbin\/sulogin<\/p>\n<p># RHEL 7<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># By default, Single User mode is password protected by the root password on RHEL 7:<\/p>\n<p>cat \/usr\/lib\/systemd\/system\/rescue.service<br \/>\n   [&#8230;]<\/p>\n<p>   [Service]<br \/>\n   Environment=HOME=\/root<br \/>\n   WorkingDirectory=\/root<br \/>\n   ExecStartPre=-\/bin\/plymouth quit<br \/>\n   ExecStartPre=-\/bin\/echo -e &#8216;Welcome to emergency mode! After logging in, type [&#8230;]<br \/>\n   ExecStart=-\/bin\/sh -c &#8220;\/usr\/sbin\/sulogin; \/usr\/bin\/systemctl &#8211;fail &#8211;no-block default&#8221; <---\n   Type=idle\n   StandardInput=tty-force\n   StandardOutput=inherit\n   StandardError=inherit\n   KillMode=process\n   IgnoreSIGPIPE=no\n   SendSIGHUP=yes\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p># RHEL 5 # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p># To force users to enter password in Single User mode, add following line to \/etc\/inittab:<\/p>\n<p>~:S:respawn:\/sbin\/sulogin<\/p>\n<p># The changes to this file takes effect after a system reboot<\/p>\n<p># To make init re-read the \/etc\/inittab without rebooting the system, type the command<\/p>\n<p>\/sbin\/init q<\/p>\n<p># RHEL 6 # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p> [&#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\/6084"}],"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=6084"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6084\/revisions"}],"predecessor-version":[{"id":6085,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6084\/revisions\/6085"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}