LinuxCommandLibrary

dm-tool

Manage device-mapper devices from the command line

TLDR

Show the greeter while keeping current desktop session open and waiting to be restored upon authentication by logged in user

$ dm-tool switch-to-greeter
copy

Lock the current session
$ dm-tool lock
copy

Switch to a specific user, showing an authentication prompt if required
$ dm-tool switch-to-user [username] [session]
copy

Add a dynamic seat from within a running LightDM session
$ dm-tool add-seat [xlocal] [name]=[value]
copy

SYNOPSIS

dm-tool [COMMAND] [ARGUMENTS]

PARAMETERS

lock
    Locks the current graphical session, requiring re-authentication to unlock.

switch-to-user <username>
    Initiates a user switch to the specified user account, prompting for their password if needed.

list-sessions
    Displays a list of all currently active LightDM sessions, including their IDs, users, and state.

switch-session <session_id>
    Switches the focus to an existing LightDM session identified by its session ID.

terminate-session <session_id>
    Forcibly terminates the specified LightDM session. Use with caution as it can lead to data loss.

add-nested-session
    Starts a new, nested X server session within the current one. Less commonly used by end-users.

DESCRIPTION

dm-tool is a command-line utility designed to interact with the LightDM display manager. It provides a means to perform various session and user management operations directly from the terminal, typically within a graphical session managed by LightDM.

Its primary functions include locking the screen, switching between different user accounts, listing active sessions, and managing individual sessions (e.g., terminating them or switching to a specific one). This tool is essential for users and administrators in environments where LightDM is the chosen display manager, enabling programmatic control over the graphical login and session environment. It acts as a lightweight interface to LightDM's D-Bus API, offering functionalities that might otherwise require graphical interaction.

CAVEATS

dm-tool requires the LightDM display manager to be running and active. It is specifically designed to interact with LightDM and will not function with other display managers like GDM or SDDM. Actions like terminate-session require appropriate permissions, often root privileges or being the owner of the session. Using terminate-session on an active session can lead to data loss for the user of that session.

DESKTOP INTEGRATION

Many desktop environments (e.g., Unity, XFCE, MATE) integrate dm-tool for their screen lock and user-switching functionalities, often mapping commands like dm-tool lock to keyboard shortcuts or power management actions.

SECURITY CONTEXT

When using dm-tool to perform actions like lock or switch-to-user, it typically operates within the security context of the currently logged-in user. However, managing other sessions or terminating them might require elevated privileges, such as root access.

HISTORY

dm-tool is an integral part of the LightDM project, which was initially developed by Canonical Ltd. for Ubuntu as an alternative to GDM. LightDM aimed to be a lightweight, extensible, and standards-compliant display manager. dm-tool was created as its accompanying command-line interface, providing a convenient way to programmatically control LightDM's features, especially for tasks like screen locking and user switching in desktop environments. Its development tracks closely with LightDM's evolution, maintaining compatibility with its D-Bus interface.

SEE ALSO

lightdm(1), loginctl(1), systemctl(1), gdmflexiserver(1)

Copied to clipboard