How to Disable the Ubuntu ‘Systemd-logind’ Service

The Core Session Manager

In modern Ubuntu Linux distributions, systemd-logind.service is a critical background daemon. It acts as the central manager for user logins, seat assignments, and hardware session tracking. Crucially, it is the service responsible for monitoring physical hardware switches—such as the laptop lid sensor, the physical power button, and the sleep button—and executing power policies (like suspending the OS) when those buttons are pressed.

While this is essential on a laptop or a desktop PC, it can occasionally cause severe issues in highly specialized server environments. If you are running Ubuntu inside a complex virtualization cluster (where the hypervisor handles power states), or if you are running a critical database server on bare metal where an accidental bump of the physical power button must never initiate a shutdown sequence, you might want to completely sever the operating system’s connection to physical ACPI power events. Completely disabling logind achieves this, though it is a highly destructive action that breaks local terminal logins.

How to Disable the Systemd Logind Service

You can forcefully mask this core service using systemctl.

Warning: Do NOT execute this on a desktop, laptop, or any system where you need to log in via a local TTY terminal or a graphical display manager (GDM). Disabling logind will break local session creation. SSH will generally still work, but local console access will fail. This is for specialized, remote-only server deployments.

  1. Open your Ubuntu Terminal or connect via SSH.
  2. Because logind is a core systemd component, simply “disabling” it is often insufficient, as other services will attempt to wake it up. You must completely mask it to link it to /dev/null:
sudo systemctl mask systemd-logind.service
  1. Stop the currently running instance:
sudo systemctl stop systemd-logind.service

Your Ubuntu server will immediately stop listening to physical power button presses or lid close events, and it will no longer track user seat assignments. If you ever need local console access again, you must run sudo systemctl unmask systemd-logind.service.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.