How to adjust screen lock settings on Linux desktop

Last updated on November 27, 2020 by Dan Nanni

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 configure screen lock settings in various Linux desktop environments.

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
[ScreenSaver]
Lock=true
LockGrace=300000
PlasmaEnabled=false
Timeout=900

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

Lock=false

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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean