2

How do I unlock the lock screen in Unity from command line?

gnome-screensaver-command -l locks the screen, but gnome-screensaver-command -d doesn't unlock the lockscreen.

Is there another way to unlock the lock screen from the command line? Not via ssh, via script, for example:

gnome-screensaver-command -l && sleep 5 && <command to unlock>
muru
  • 197,895
  • 55
  • 485
  • 740
Gugi
  • 33

1 Answers1

4

For Ubuntu 16.04 and later:

loginctl unlock-sessions

No need for root, but needs session permission obviously.

Note:
By default gnome-screensaver-command -d doesn't work anymore in Unity but with this workaround (enable on-screen keyboard) it does. Works for both 14.04 and 16.04.

lemonsqueeze
  • 1,634