How to adjust screen lock settings on Linux desktop

Every major Linux desktop nowadays comes with a screensaver program by default (e.g., xscreensaver), which then can be used to lock the screen for security purposes. The default screensaver is typically configurable, and you can change settings like inactivity period or screen lock delay. You may want to adjust these settings based on your typical work environment. Also, in case you want prevent your screen from going off and locked down for an extended period of time (e.g., when watching a movie), you probably want to disable screen lock feature.

In this tutorial, I am going to show how to control screen lock on various Linux desktop environment.

GNOME 3 Desktop

Go to "System Settings" -> "Brightness and Lock". In this setting, you can set screen inactivity period and screen lock delay. Also, you can enable or disable screen locking.

If you want to control screen lock from the command line, here is how to do it.

To activate screensaver and lock the screen after 10 minutes:

$ dconf write /org/gnome/desktop/session/idle-delay 600

To disable screen lock:

$ dconf write /org/gnome/desktop/screensaver/lock-enabled false

Alternatively, you can use dconf-editor, a GUI-frontend for dconf command.

To install dconf-editor on Debian, Ubuntu or Linux Mint:

$ sudo apt-get install dconf-tools

To install dconf-editor on Fedora:

$ sudo yum install dconf-editor

To launch dconf-editor, simply run it.

$ dconf-editor

KDE Desktop

Go to "System Settings" -> "Display and Monitor". Choose "Screen Locker" menu in the left. Here, you can change screen inactivity period and screen lock delay. Also, you can enable or disable screen locking. In this example, screensaver will be launched after 15 minutes of inactivity. After 300 seconds from that point on, screen lock will be activated, requiring password authentication.

To adjust screen lock settings from the command line, you can edit ~/.kde/share/config/kscreensaverrc. Create the file if it does not exist. Once the file is edited, the change will automatically take effect immediately.

$ vi ~/.kde/share/config/kscreensaverrc


To disable screen lock, simply change the following setting in ~/.kde/share/config/kscreensaverrc.


Xfce/LXDE Desktop

Go to "Settings Manager" -> "Screensaver". In this settings, you can change screensaver activation time and screen lock delay, as well as enable/disable screen lock.

Once you change screensaver preferences via GUI like above, it will create ~/.xscreensaver, which is a screensaver preference file. You can also edit this file manually to adjust screen lock settings, without going through GUI.

$ vi ~/.xscreensaver

To disable screen lock, simply change the setting in ~/.xscreensaver

Lock: False

Linux Mint MATE/Cinnamon Desktop

You can follow the same steps as in GNOME 3 desktop.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Leave a comment

Your email address will not be published. Required fields are marked *

Current day month ye@r *