Single User Mode Definition

Single user mode, also referred to as maintenance mode and runlevel 1, is a mode of operation of a computer running Linux or another Unix-like operating system that provides as few services as possible and only minimal functionality. It is useful for booting (i.e., starting) a computer whose operating system has been damaged and is not capable of normal operation and for performing some diagnostic and repair tasks.

Unix-like operating systems are normally operated in multi-user mode, which not only allows multiple users to log in and use the system simultaneously, but also allows the full range of system services, including network connections and the X Window System, which provides a GUI (graphical user interface).

A runlevel is any of several operating states of a computer, each allowing the operation of a different set of services. By default Linux boots into either runlevel 3 or runlevel 5, both of which are multi-user modes. The former permits the system to run all services except for a GUI; the latter allows all services including the GUI1.

Among the administrative tasks for which single user mode is useful is using fsck to repair corrupted filesystems, such as /usr, which is often a separate partition (i.e., a logically independent section of a hard disk drive). Such repair should only be performed on unmounted (i.e., not logically attached to the system) filesystems, and it is easy to unmount filesystems in single user mode because of its minimal functionality and consequent need for only a few basic filesystems such as /bin and /sbin, which contain diagnostic and repair programs.

Another use of single user mode is the situation in which a computer will boot up but will not allow the user to log in after the booting process has been completed. One reason that this can occur is that an incorrect password is being used. Once in single user mode, it is fairly easy to change the password and reboot the system to normal operation.

It is possible to switch into single user mode both on a running system and by booting directly into it. For example, with regard to the former, it can be accomplished by the root (i.e., administrative) user by using the telinit command with the number 1 (for runlevel 1) as an argument (i.e., input) as follows:

telinit 1

The ability to boot a computer into single user mode can be a major security hole, as it will give intruders immediate root access. Thus, it is important to configure the system to require a password for such operations.

Single user mode is just one of several modes of logging into a damaged system. The others are automatic rescue mode, read-only rescue mode and manual rescue mode.

1For example, using the ps command (with its -a, -u and -x options) on a typical Red Hat system, it was found that the number of processes (i.e., instances of running programs) in single user mode was 21, as compared with 53 in runlevel 3 and 75 in runlevel 5.

Created June 16, 2006.
Copyright © 2006 The Linux Information Project. All Rights Reserved.