How to Completely Disable the ‘systemd-userdbd’ Service in Ubuntu Server

In Ubuntu Server environments, systemd-userdbd.service is a systemd daemon that provides a unified, multiplexed API for querying user and group records. It acts as a bridge between various identity providers (like LDAP, Active Directory via SSSD, or systemd’s own JSON user records) and the system services that require user metadata. While highly useful in complex enterprise environments with centralized directory services, it is largely superfluous on minimal, standalone servers or dedicated appliances that only rely on the standard local /etc/passwd and /etc/group files. In these minimal deployments, disabling this daemon reduces system complexity, saves a small amount of memory, and slightly tightens the attack surface.

This guide explains how to completely disable the systemd-userdbd.service in Ubuntu Server, ensuring that user and group queries bypass the multiplexer and rely solely on traditional local file lookups.

Stop and Mask the systemd-userdbd Service

Because systemd services often rely on socket activation (where the service starts automatically when a client attempts to connect to its socket), we must disable both the service unit and its associated communication socket to ensure it remains permanently dead.

  1. Log into your Ubuntu Server via SSH using an account with sudo privileges.
  2. First, stop the service and the socket if they are currently active:
    sudo systemctl stop systemd-userdbd.service systemd-userdbd.socket
  3. Next, disable them to prevent them from starting automatically on boot:
    sudo systemctl disable systemd-userdbd.service systemd-userdbd.socket
  4. Finally, to guarantee that systemd completely ignores the units and prevents any other dependent service from triggering them via socket activation, mask them entirely:
    sudo systemctl mask systemd-userdbd.service systemd-userdbd.socket

Verify the Service Lockdown

By masking both the service and the socket, you have instructed systemd to symlink the unit files to /dev/null, effectively removing the user record multiplexing capability from the operating system.

To verify the lockdown is successful, run the following command to check the status of both units:

systemctl status systemd-userdbd.service systemd-userdbd.socket

The output for both will clearly state that they are masked. You can also run standard user querying commands like getent passwd to confirm that local user lookups still function perfectly using the traditional Name Service Switch (NSS) configuration, proving that the overarching daemon was successfully and safely eliminated from the stack.

Get the best tech tips delivered straight to your inbox.

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