Linux Commands Examples

A great documentation place for Linux commands


Single-user login

see also : init


sulogin [ -e ] [ -p ] [ -t SECONDS ] [ TTY ]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


no example yet ...

... Feel free to add your own example above to help other Linux-lovers !


sulogin is invoked by init(8) when the system goes into single user mode. (This is done through an entry in inittab(5).) Init also tries to execute sulogin when the boot loader (e.g., grub(8)) passes it the -b option.

The user is prompted

Give root password for system maintenance

(or type Control-D for normal startup):

If the root account is locked, as is the default on Ubuntu, no password prompt is displayed and sulogin behaves as if the correct password were entered.

sulogin will be connected to the current terminal, or to the optional device that can be specified on the command line (typically /dev/console).

If the -t option is used then the program only waits the given number of seconds for user input.

If the -p option is used then the single-user shell is invoked with a dash as the first character in argv[0]. This causes the shell process to behave as a login shell. The default is not to do this, so that the shell will not read /etc/profile or $HOME/.profile at startup.

After the user exits the single-user shell, or presses control-D at the prompt, the system will (continue to) boot to the default runlevel.

environment variables

sulogin looks for the environment variable SUSHELL or sushell to determine what shell to start. If the environment variable is not set, it will try to execute root’s shell from /etc/passwd. If that fails it will fall back to /bin/sh.

This is very valuable together with the -b option to init. To boot the system into single user mode, with the root file system mounted read/write, using a special "fail safe" shell that is statically linked (this example is valid for the LILO bootprompt)

boot: linux -b rw sushell=/sbin/sash

fallback methods

sulogin checks the root password using the standard method (getpwnam) first. Then, if the -e option was specified, sulogin examines these files directly to find the root password:

/etc/shadow (if present)

If they are damaged or nonexistent, sulogin will start a root shell without asking for a password. Only use the -e option if you are sure the console is physically protected against unauthorized access.

see also

init , inittab.


Miquel van Smoorenburg <miquels[:at:]cistron[:dot:]nl>

How can this site be more helpful to YOU ?

give  feedback