Unlock Unity Lockscreen from Command Line

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>
6

1 Answer

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest