LinuxCommandLibrary

xtrlock

Lock X session (screen lock)

TLDR

Lock the display and show a padlock instead of the cursor

$ xtrlock
copy

Display a blank screen as well as the padlock cursor
$ xtrlock -b
copy

Fork the xtrlock process and return immediately
$ xtrlock -f
copy

SYNOPSIS

xtrlock

DESCRIPTION

xtrlock is a lightweight and extremely simple screen locker for the X Window System. Unlike many modern screen lockers, it does not blank the screen or display a fancy lock overlay. Instead, it works by grabbing the X server's keyboard and pointer input, effectively locking the session.

When activated, it typically opens an xterm (or similar terminal emulator) window to prompt the user for a password. Upon successful authentication (usually checking against the user's password or root password via su or sudo), the input devices are ungrabbed, and the X session is unlocked. Its primary appeal lies in its minimal resource usage and straightforward design, making it suitable for users who prioritize simplicity and do not require screen blanking or complex features. It's often used in conjunction with a hotkey or an idle timer to automatically lock the screen.

CAVEATS

xtrlock does not blank the screen. This means the contents of your screen remain visible while locked, which can be a privacy concern in some environments.

It typically relies on an external terminal emulator (like xterm) to display the password prompt. If xterm is not installed or configured correctly, xtrlock may not function as expected.

Security relies on the robustness of the X server's input grabbing mechanism. While generally effective, it's a very basic locking mechanism compared to modern alternatives.

It might require elevated privileges (e.g., setuid root) to successfully grab input devices, depending on system configuration and X server permissions.

HOW IT WORKS

xtrlock operates by making an X server request to 'grab' the keyboard and pointer devices. This prevents any other application or user from receiving input events until xtrlock releases the grab. The password prompt is then displayed in a new xterm window launched by xtrlock.

USAGE EXAMPLE

Users often bind xtrlock to a keyboard shortcut (e.g., Ctrl+Alt+L) or configure their window manager to execute it after a period of inactivity to automatically lock the session.

HISTORY

xtrlock is one of the earliest and most basic screen lockers developed for the X Window System. Its origins trace back to the early days of X, reflecting a design philosophy focused on minimal functionality and resource consumption. Unlike later, more feature-rich screen savers and lockers, xtrlock's design has remained largely unchanged, emphasizing its core function of simply grabbing input and requiring a password without any visual flair or screen blanking capabilities. This simplicity has ensured its continued presence in minimalist Unix-like environments, even as more advanced locking solutions became available.

SEE ALSO

xlock(1), slock(1), i3lock(1), xterm(1), vlock(1)

Copied to clipboard