Automatic root login in Debian 8.0 (console only)

The file /etc/inittab is not used under systemd any longer. If you wanted, you could install systemv and you would find yourself a brand new inittab, but this would mean walking backward like crabs.

You can instead edit the file /lib/systemd/system/[email protected] and change the line

  ExecStart=-/sbin/agetty --noclear %I $TERM

to

  ExecStart=-/sbin/agetty --noclear -a root %I $TERM

This just follows from the agetty manual page, which states, among other things:

-a, --autologin username

Log the specified user automatically in without asking for a login name and password. The -f username option is added to the /bin/login command line by default. The --login-options option changes this default behavior and then only \u is replaced by the username and no other option is added to the login command line.

To be sure, I just tested this on my Debian VM, and it works fine.


DO NOT edit the units in /lib/systemd directly, since those are managed by installed packages, and would be overwritten during package upgrades.

Instead, use $ sudo systemctl edit [email protected] to create a drop-in unit at /etc/systemd/system/[email protected]/override.conf with the following contents:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --noclear --autologin your_user_name %I $TERM

It has the same effects as @MariusMatutiae's answer, but won't be touched during system upgrades.

The first line selects the [Service] section to override. The second line explicitly clears the ExecStart entry -- otherwise the original ExecStart in /lib/systemd would still be effective, since multiple ExecStart directives are allowed in a single oneshot service unit. And the last line defines the new ExecStart command line, which is already explained in @MariusMatutiae's answer.

Refer to the systemd.unit(5) manual pages for more details and examples.

Tags:

Linux

Debian