CentOS / RHEL 6 : How to password-protect single user mode

Locking down single-user mode in RHEL6 requires editing /boot/grub/grub.conf and /etc/sysconfig/init.

1. Change the definition of the single user login shell in /etc/sysconfig/init from sushell to sulogin

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

2. You can also use sed to directly change the required line :

# sed -i "s,^SINGLE=.*,SINGLE=/sbin/sulogin," /etc/sysconfig/init

3. Doing the above results in single-user mode showing the same login prompt normally seen in emergency (maintenance) mode as shown below :

Related Post