How to set password for Single-User mode on Linux (CentOS/RHEL)

34

What is Single-User mode on Linux? That is a mode help you restore some config or operation on OS Linux like reset password root when you forgot it,… However, if you don’t try to protect this mode, your system will have a exploited vulnerability so you need to set password for Single-user mode.

(single-user grub mode, before prompt pass single-mode appear phase)

Note:
– When you set password for single-user mode on Linux, you have to remember or note your password of root for future login in single-user mode. If you forgot it, you will have to use DVD Linux recuse to reset root password.

Step-by-step to set password for Single-user mode on

First of all, you need to config file ‘/etc/inittab’:

 
You have to insert config line “~~:S:wait:/sbin/sulogin” before config line ‘initdefault‘. So now the content of config file ‘/etc/inittab‘ will be like below:

 
The last step, that you have to change config in file ‘/etc/sysconfig/init‘ :

change to

 
Finally, you can reboot OS and try to boot to single-user mode and check that a prompt password appears or not. So now you have completed the way to set password for Single-user mode on Linux. Good luck !

LEAVE A REPLY