LinuxCommandLibrary

i3lock

Lock the screen

TLDR

Lock the screen showing a white background

$ i3lock
copy

Lock the screen with a simple color background (rrggbb format)
$ i3lock [[-c|--color]] [0000ff]
copy

Lock the screen to a PNG background
$ i3lock [[-i|--image]] [path/to/file.png]
copy

Lock the screen and disable the unlock indicator (removes feedback on keypress)
$ i3lock [[-u|--no-unlock-indicator]]
copy

Lock the screen and don't hide the mouse pointer
$ i3lock [[-p|--pointer]] [default]
copy

Lock the screen to a PNG background tiled over all monitors
$ i3lock [[-i|--image]] [path/to/file.png] [[-t|--tiling]]
copy

Lock the screen and show the number of failed login attempts
$ i3lock [[-f|--show-failed-attempts]]
copy

SYNOPSIS

i3lock [options]

Example: i3lock --color=000000 --image=~/lock_screen.png
Example: i3lock --blur=5 --show-failed-attempts

PARAMETERS

--help
    Show a help message and exit.

--version
    Show version information and exit.

--color=<hex_color>
    Set a solid background color (e.g., 000000 for black). Must be a 6-digit hexadecimal RGB value.

--image=<path_to_image>
    Use an image file as the background. Supported formats depend on loaded libraries (e.g., PNG, JPEG).

--tiling
    Tile the image specified by --image across the screen instead of scaling it.

--blur=<radius>
    Apply a blur effect to the background, optionally with a specified radius (default is 5 if no radius is given).

--pixelate
    Apply a pixelation effect to the background before displaying.

--no-fork
    Do not fork into the background; run i3lock in the foreground. Useful for debugging or scripting.

--override-dpms
    Prevent the display from going into power-saving mode (DPMS) while locked.

--no-indicator
    Do not display the password input indicator circle or line.

--ignore-empty-password
    Require a password even if the user account has an empty password set.

--no-unlock-indicator
    Do not show any visual feedback (e.g., wrong password, unlock status) other than the background.

--no-bell
    Disable the system bell sound on key presses or authentication errors.

--line-uses-color
    Color the password indicator line based on input status (e.g., green for correct, red for incorrect).

--keylayout
    Display the current keyboard layout near the input indicator.

--show-failed-attempts
    Show the number of incorrect password attempts after each failed try.

DESCRIPTION

i3lock is a simple, modern, and secure screen locker for the X Window System. Designed to be lightweight and robust, it effectively locks your screen, preventing unauthorized access to your session. When activated, i3lock typically presents a blank screen, an image, or a blurred view of your current desktop, prompting for your user password. It integrates well with the i3 window manager but operates independently.

i3lock aims for simplicity and reliability, focusing on its core function of locking the screen without unnecessary features, making it a preferred choice for users seeking a no-frills security solution. It supports various visual customizations, like background colors, images, and blurring effects, while maintaining a strong emphasis on security by disallowing arbitrary GUI elements and relying on PAM for authentication.

CAVEATS

While robust, i3lock is a client-side X11 application; a compromised X server or root access can potentially bypass it. It relies on PAM for authentication, so proper PAM configuration is crucial. As an X11-specific tool, it does not directly operate on Wayland, though compatibility layers might exist. It does not handle system suspend/hibernate actions directly, requiring external scripting or systemd hooks for pre-sleep locking.

AUTHENTICATION

i3lock leverages PAM (Pluggable Authentication Modules) for user authentication. This allows it to integrate seamlessly with system-wide authentication configurations, including LDAP, local user accounts, and other PAM modules.

SECURITY FOCUS

Unlike some screen lockers, i3lock is designed with a strong security focus. It avoids complex graphical elements like buttons or input fields, reducing the attack surface. It draws directly to the screen and relies on the X server's security features for input capture.

INTEGRATION WITH DESKTOP ENVIRONMENTS

While primarily associated with the i3 window manager, i3lock can be used with any X11-based desktop environment or window manager. Users often integrate it with keyboard shortcuts or scripts that automatically lock the screen after inactivity.

HISTORY

i3lock was developed as a part of the i3 window manager project by Michael Stapelberg and other contributors. Its design philosophy mirrors i3's emphasis on simplicity, correctness, and speed. It has been actively maintained, focusing on stability and security, and has gained significant popularity due to its lightweight nature and strong integration within the i3 ecosystem.

SEE ALSO

slock(1), xautolock(1), xscreensaver(1), i3(1)

Copied to clipboard