3

What is the smartest way to temporarily disable the Automatic Screen Lock function?

Think of this usecase: The default setting of the machine is a very low blanking time to agressively save energy and automatic screen lock right after for security (in case one walks away from the machine and forgets to lock it).

Now sometimes the machine is supposed to be shared. Imagine for cooking. You want to be able to see the recipie right after touching one button without entering a password. (Maybe you have dirty hands or someone else is using the machine who does not know the password.)

The standard way to deal with this is to disable the automatic screen lock, either from GUI or from the CLI. The issue here is that reenabling it afterwards is a tedious task, that is easily forgotten.

The question now is, how to disable the Automatic Screen Lock only for a specified time (1 hour, 1 day) or until a specific event (shutdown).

My idea is to use anacron to set it to enabled every day. Yet I do not feel like this is very elegant. Any better solutions?

1 Answers1

1

What is the smartest way to temporarily disable the Automatic Screen Lock function?

Use the method from the link you used for the CLI way so ...

gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false'

My idea is to use anacron to set it to enabled every day.

The easiest method to me would be using the at command. at is set up such that you can words to explain when it should be executed and consists of 3 commands:

at : execute commands at specified time.
atq : lists the pending jobs of users.
atrm : delete jobs by their job number.

at can use words like:

noon    
midnight    
teatime     
tomorrow    
noon tomorrow   
next week   
next monday     
midnight    
now + 2 days
4 PM + 2 days

So

echo "gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'" | at 9:00 AM

would lock the screen at 9 am.

 echo "gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false'" | at midnight

would unlock it at midnight.

You can put a whole array of these commands in a script and call that script from cron (/etc/crontab with the @reboot method), on boot (/etc/rc.d/rc.local) or on login (~.bash_profile) or from anacron.

Rinzwind
  • 299,756