I have already described a straightforward way to automatically login user at the console without touching the graphical user interface using Debian Wheezy, so today I will post an update for Debian Jessie as the whole process has changed considerably.
The procedure is as simple as it was before the system update, the only difference is that now it depends on systemd
to manage getty
service. I will configure getty
to automatically log in as milosz
user on tty3
.
Copy default getty
service configuration to isolate tty3
terminal.
$ sudo cp /etc/systemd/system/getty.target.wants/getty@tty{1,3}.service
Configure service to automatically log in as milosz
user and wait for any key before dropping to the shell (see agetty
manual page).
$ sudo sed -i -e "s/\/sbin\/agetty/\0 --login-pause --autologin milosz/" /etc/systemd/system/getty.target.wants/getty@tty3.service
You can ignore this step as it is not strictly required, but for the sake of simplicity replace tty1
occurrences in the install
section.
$ sudo sed -i -e "s/tty1/tty3/" /etc/systemd/system/getty.target.wants/getty@tty3.service
Reload systemd manager configuration.
$ sudo systemctl daemon-reload
Now, you can simply reboot
to apply changes or kill getty
process attached to the tty3
terminal to immediately take advantage of the new configuration.
$ systemctl status getty@tty3.service ● getty@tty3.service - Getty on tty3 Loaded: loaded (/etc/systemd/system/getty.target.wants/getty@tty3.service; disabled; vendor preset: enabled) Active: active (running) since wto 2016-05-31 14:06:49 CEST; 1h 20min ago Docs: man:agetty(8) man:systemd-getty-generator(8) http://0pointer.de/blog/projects/serial-console.html Main PID: 7884 (agetty) CGroup: /system.slice/system-getty.slice/getty@tty3.service └─7884 /sbin/agetty --noclear tty3 linux maj 31 14:06:49 milosz-XPS-13-9343 systemd[1]: Started Getty on tty3.
$ pgrep -u root -a -f "getty.*tty" 7884 /sbin/agetty --noclear tty3 linux 8142 /sbin/agetty --noclear tty4 linux 8152 /sbin/agetty --noclear tty6 linux 8651 /sbin/agetty --noclear tty1 linux 8760 /sbin/agetty --noclear tty2 linux
$ sudo kill 7884
$ systemctl status getty@tty3.service ● getty@tty3.service - Getty on tty3 Loaded: loaded (/etc/systemd/system/getty.target.wants/getty@tty3.service; disabled; vendor preset: enabled) Active: active (running) since wto 2016-05-31 15:28:54 CEST; 7s ago Docs: man:agetty(8) man:systemd-getty-generator(8) http://0pointer.de/blog/projects/serial-console.html Main PID: 9837 (agetty) CGroup: /system.slice/system-getty.slice/getty@tty3.service └─9837 /sbin/agetty --login-pause --autologin milosz --noclear tty3 linux maj 31 15:28:54 milosz-XPS-13-9343 systemd[1]: getty@tty3.service: Service has no hold-off time, scheduling restart. maj 31 15:28:54 milosz-XPS-13-9343 systemd[1]: Stopped Getty on tty3. maj 31 15:28:54 milosz-XPS-13-9343 systemd[1]: Started Getty on tty3.
$ pgrep -u root -a -f "getty.*tty" 8142 /sbin/agetty --noclear tty4 linux 8152 /sbin/agetty --noclear tty6 linux 8651 /sbin/agetty --noclear tty1 linux 8760 /sbin/agetty --noclear tty2 linux 9837 /sbin/agetty --login-pause --autologin milosz --noclear tty3 linux
Now you will be automatically logged in whenever you switch to the tty3
console.
Additional notes
Read agetty
manual page for additional options.
Remove created service and reload systemd manager configuration to reverse modifications.
Default service file:
$ cat /etc/systemd/system/getty.target.wants/getty@tty1.service
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=Getty on %I Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=http://0pointer.de/blog/projects/serial-console.html After=systemd-user-sessions.service plymouth-quit-wait.service After=rc-local.service # If additional gettys are spawned during boot then we should make # sure that this is synchronized before getty.target, even though # getty.target didn't actually pull it in. Before=getty.target IgnoreOnIsolate=yes # IgnoreOnIsolate causes issues with sulogin, if someone isolates # rescue.target or starts rescue.service from multi-user.target or # graphical.target. Conflicts=rescue.service Before=rescue.service # On systems without virtual consoles, don't start any getty. Note # that serial gettys are covered by serial-getty@.service, not this # unit. ConditionPathExists=/dev/tty0 [Service] # the VT is cleared by TTYVTDisallocate ExecStart=-/sbin/agetty --noclear %I $TERM Type=idle Restart=always RestartSec=0 UtmpIdentifier=%I TTYPath=/dev/%I TTYReset=yes TTYVHangup=yes TTYVTDisallocate=yes KillMode=process IgnoreSIGPIPE=no SendSIGHUP=yes # Unset locale for the console getty since the console has problems # displaying some internationalized messages. Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= [Install] WantedBy=getty.target DefaultInstance=tty1