How to enable single user mode only for root user in Linux

1. From your Linux machine access a terminal window and open /etc/inittab file for edit.

2. In this file add the below given line just before the id:X:initdefault: entrysu:S:wait:/sbin/sulogin

3. Save the /etc/ininttab file.

[root@xnetbd ~]# vim /etc/inittab

su:S:wait:/sbin/sulogin
id:3:initdefault:

4. Now from next time onwards you will be prompted to provide the root password before accessing the single user mode.

Example:This can be prevented by making your linux machine to ask for the root password even when the system is made to boot into single user mode.