NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
DE

Diese ausführliche Anleitung ist auf Englisch verfügbar.

English version

Linux Desktops and User Land Infrastructure

Configuring Systemd-Logind to Secure Virtual Consoles on Multi-User Desktop Nodes

Virtual consoles on multi-user desktops are a security boundary that is often overlooked. A user who switches to another console can access a session left unlocked or escalate privileges. Systemd-logind controls seat assignment, session tracking, and console switching. This guide hardens it.

Kernpunkte

  • Disable unused virtual consoles. Reduce the number of getty instances to limit attack surface.
  • Configure console switching. Restrict Ctrl+Alt+Fx switching to prevent unauthorized console access.
  • Set idle session timeouts. Automatically lock sessions that have been idle too long.
  • Manage seat assignment. Ensure each user gets a dedicated seat with isolated devices.
  • Enable session tracking. Logind tracks sessions for audit and policy enforcement.
  • Configure polkit rules. Restrict who can reboot, suspend, or change system settings.
  • Protect the graphical session. Ensure the display manager starts on a dedicated VT.
  • Audit sessions. Use loginctl to review active sessions and seats.

Architecture

Logind manages seats, sessions, and virtual consoles. Each physical console maps to a seat, and sessions are tracked per user. Console switching is mediated by logind, which can restrict or disable it. Polkit provides additional authorization.

Production configuration

Logind configuration ini
# /etc/systemd/logind.conf
[Login]
NAutoVTs=2
ReserveVT=1
KillUserProcesses=yes
IdleAction=lock
IdleActionSec=300
HandlePowerKey=poweroff
HandleSuspendKey=suspend
HandleLidSwitch=suspend
Disable extra gettys bash
systemctl disable getty@tty3.service
systemctl disable getty@tty4.service
systemctl disable getty@tty5.service
systemctl disable getty@tty6.service
systemctl daemon-reload

loginctl show-seat seat0 -p VTNr
Polkit rule for console access javascript
polkit.addRule(function(action, subject) {
  if (action.id == "org.freedesktop.login1.set-wall-message" &&
      subject.isInGroup("admins")) {
    return polkit.Result.YES;
  }
  return polkit.Result.NOT_HANDLED;
});

Edge cases from production

  • Disabling all VTs breaks emergency recovery; keep at least one reserved.
  • IdleAction=lock requires a screen locker; ensure one is installed and configured.
  • Some applications expect VT switching; test before restricting.
  • Logind changes require a daemon restart or reboot to take full effect.

Häufige Fragen

Can I disable virtual consoles entirely?

Yes, but keep at least one for recovery.

How do I lock idle sessions?

Set IdleAction=lock and IdleActionSec in logind.conf.

What is a seat?

A collection of input and output devices assigned to a user.

How do I audit sessions?

Use loginctl list-sessions and loginctl show-session.

Does this affect SSH?

No, SSH sessions are separate from virtual consoles.

Wie Kinetikatech bei linux desktops and user land infrastructure hilft

Das haben wir schon hundertfach gelöst: Hardening compositors, sandboxing desktop apps, and tuning the user land that developers and operators actually touch. Mit Serververwaltung und Website-Wartung erhalten Sie den kompletten Kreislauf: Wir bewerten, wir setzen um, wir überwachen rund um die Uhr und wir reagieren innerhalb von 30 Minuten, wenn es darauf ankommt.

Mit einem Ingenieur sprechen

Serverproblem? Gehackte Website? Langsame Seite?

Kritische Störungen in 30 Minuten beantwortet — rund um die Uhr, 7 Tage die Woche.

Notfall-Support anfordern support@kinetikatech.com