Ubuntu – Unlock screen from command line

keyboardlock-screenunityvirtualbox

I was using virtualbox on a laptop and closed the lid which locked the screen and sleep the computer. Now it came back from sleep, the screen is locked, but I can not type my password. The mouse work, I can set focus in the password box, but typing does nothing.

I guess the keyboard is held by virtualbox.

I tried plugin in a keyboard, no luck. I tried killing unity-panel-service –lockscreen-mode, it seems to have a watchdog that restart it.

I'll find some command line to sleep my vm, but is there anyway to unlock the screen from command line ?

Best Answer

Go to TTY and run the command:

sleep 5; xdotool type <yourpassword>; xdotool key Return

and then go back to the login screen and click in the password box. Wait ~5 secs and your password will be typed and enter will have been pressed.

My pronouns are He / Him

Related Question