When I close my laptop, on Ubuntu 19.10, I want to prevent others from accessing my computer and also hide, whatever is shown on my screen.

Now, when I open the lid, the desktop shows for a fraction of a second, before the log-in screen comes up.

Any intruder in my office now could use a camera and film the moment before the screen locks ans possibly see confident information, open on my desktop.

How do I prevent this privacy issue?


OS: Ubuntu 19.10

I could reproduce the issue in the below case.

if the file /etc/systemd/logind.conf is untouched and the gsettings values are also untouched

gsettings list-recursively | grep "ac-action \|e-battery-action '"

org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'


edit the file /etc/systemd/logind.conf and change the line
#HandleLidSwitch=..... to HandleLidSwitch=lock

not sure reboot is required or this command systemctl restart systemd-logind.service. I did reboot and works as intended.




some of the content from above link

   HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=,
   HandleLidSwitchExternalPower=, HandleLidSwitchDocked=
       Controls how logind shall handle the system power and sleep keys and the lid switch to
       trigger actions such as system power-off or suspend. Can be one of "ignore",
       "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep",
       "suspend-then-hibernate", and "lock".
| improve this answer | |
  • This solves the privacy issue, bit it is not really a workaround, since it changes the default behaviour, that the laptop suspends when the lid is closed. With HandleLidSwitch=lock it only locks the screen but the laptop continues to run in this closed state. – rubo77 Jan 5 at 0:21
  • systemctl restart systemd-logind.service didn't work, I got a black screen with just a mousepointer after some time. I had to reboot then – rubo77 Mar 4 at 2:52

There is no real solution to this known bug. It is an unsolved graphical driver issue.

A solution to the security issue would be to set the action on lid-close to "lock" instead of "suspend"

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.