13

How do I stop my GNOME desktop from locking the screen after a few minutes of idle time?

I already tried the official manual at Red Hat and tried to use gconf-editor and gconftool-2 to set /apps/panel/global/disable_log_out and /apps/panel/global/disable_lock_screen. No luck.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kashyap
  • 15,354
  • 13
  • 64
  • 103

3 Answers3

35

On newer distributions of Linux, like Red Hat and CentOS 7, which run GNOME 3.x you'll want to disable this via the gsettings utility rather than gconftool-2. The default is 5 minutes before the system is considered idle. Setting the value to 0 disables this.

gsettings set org.gnome.desktop.session idle-delay 0

This setting can also be made in the GUI dconf-editor from a logged in session of the user in question.

From the standard System ToolsSettings application, there is also a "Blank Screen" option in the power settings which may provide the same behavior as the gsettings command given previously. In my testing, setting the "Screen Lock" to "Off" in the privacy settings DID NOT disable the screen blanking after 5 minutes.

On a final note, you cannot run that gsettings command from a remote SSH session without getting errors. See the last reference link below.

It was quite a research effort to get this disabled on my virtual machine!

References:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mark Edington
  • 6,484
  • 3
  • 33
  • 33
  • 2
    Works great! On a side note, the value is in seconds, so resetting it to 5 minutes would be `gsettings set org.gnome.desktop.session idle-delay 300` – Force Feb 18 '18 at 18:11
  • Is there a way to query the current value from the commandline too? – shevy Mar 03 '19 at 18:09
  • @shevy sorry I don't know offhand. I assume you tried `gsettings get ...` but other than that it's been awhile since I wrote this and I'm not a gesettings expert! – Mark Edington Mar 04 '19 at 02:00
  • If you have Anaconda installed, make sure you use `/usr/bin/gsettings`, by default `gsettings` might run `/home/USER/anaconda3/bin/gsettings`. – Tahlor Jun 01 '23 at 18:25
7

The gconf schema entry for this in /etc/gconf/schemas/desktop_gnome_lockdown.schemas, and it would seem to be that the following command would disable the GNOME desktop lock screen:

 gconftool-2 --set /schemas/desktop/gnome/lockdown/disable_lock_screen --type boolean true

However, in reality it seems that no attention is paid to this parameter (in OL 7.2 anyways).

An effective, but clumsy, workaround is to navigate in the GUI to ApplicationSystemToolsSettingsPower and set PowerSaving Blank Screen to "Never".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Quinn Carver
  • 587
  • 7
  • 14
4

The screen saver can also lock the screen. Uncheck either 'Activate screensaver when computer is idle' or 'Lock screen when screensaver is active' or both in screensaver preferences. From commandline use gnome-screensaver-preferences or goto 'System->Preferences->Screensaver'.

I think the corresponding keys (for use with gconftool-2) are /apps/gnome-screensaver/idle_activation_enabled and /apps/gnome-screensaver/lock_enabled.

HTH

Kashyap
  • 15,354
  • 13
  • 64
  • 103