RHEL: Force system to prompt for password in Single User mode

RHEL: Force system to prompt for password in Single User mode

# Tested on RHEL 5, 6 & 7

# Due to security reasons, one may want to force system to prompt for root password even
# in Single User mode

# By default, system doesn't ask for password and we are given root shell directly. Indeed,
# usually Single User mode is used to reset root password in case we forgot it.

# Note that after modifying configuration, in case of forgotten root password, you'll have
# to boot the system in rescue mode to revert configuration in order to be able to change
# root password in Single User mode.

# RHEL 5
# ------------------------------------------------------------------------------------------

# To force users to enter password in Single User mode, add following line to /etc/inittab:


# The changes to this file takes effect after a system reboot

# To make init re-read the /etc/inittab without rebooting the system, type the command

/sbin/init q

# RHEL 6
# ------------------------------------------------------------------------------------------

# Edit /etc/inittab and add "su:S:wait:/sbin/sulogin" before 'initdefault' line:

vi /etc/inittab

# Edit /etc/sysconfig/init and replace "SINGLE=/sbin/sushell"  with "SINGLE=/sbin/sulogin":

vi /etc/sysconfig/init
   # Set to '/sbin/sulogin' to prompt for password on single-user mode
   # Set to '/sbin/sushell' otherwise

# RHEL 7
# ------------------------------------------------------------------------------------------

# By default, Single User mode is password protected by the root password on RHEL 7:

cat /usr/lib/systemd/system/rescue.service

   ExecStartPre=-/bin/plymouth quit
   ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type [...]
   ExecStart=-/bin/sh -c "/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default" <---
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Jak wygenerować silne hasła jednorazowe w Linuksie?
Viewed 845 times since Thu, May 24, 2018
How to enable Proxy Settings for Yum Command on RHEL / CentOS Servers
Viewed 757 times since Thu, Jul 19, 2018
Turbocharge PuTTY with 12 Powerful Add-Ons – Software for Geeks #3
Viewed 873 times since Sun, Sep 30, 2018
Testing TLS/SSL encryption
Viewed 447 times since Thu, Jan 16, 2020
RHCS: Configure an active/backup pacemaker cluster
Viewed 887 times since Sun, Jun 3, 2018
LVM: Create a new Volume Group
Viewed 641 times since Sat, Jun 2, 2018
8 Vim Tips And Tricks That Will Make You A Pro User
Viewed 483 times since Fri, Apr 19, 2019
RHEL: Extending a multipath LUN
Viewed 1049 times since Sun, May 27, 2018
CentOS / RHEL 7 : Configuring an NFS server and NFS client Linux NFS
Viewed 452 times since Fri, Feb 21, 2020
How To Ping Specific Port Number
Viewed 174 times since Mon, Jun 1, 2020