Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to unlock the 13.04 Gnome shell login screen from a command line? A user is logged in to Gnome shell, I can log in to a console as this user. I also have root access.

This is for accessing an active X11 display through VNC, without having to enter the password.

Executing

gnome-screensaver-command -d

as suggested in a blog post didn't help.

login screen

share|improve this question
    
Is ssh throwing you any output or error? –  Braiam Sep 3 '13 at 21:46
    
@Braiam: I can ssh in, that's not the problem. It's for accessing an active X11 display through VNC, but without having to enter the password. –  krlmlr Sep 3 '13 at 22:37

2 Answers 2

The problem with executing commands like gnome-screensaver-command from an SSH session is usually that they don't automatically connect to the appropriate session bus for the active desktop session - usually, setting the DISPLAY variable will fix that, for example these work for me (logged in via SSH as the same user who owns the locked X session, which is on DISPLAY :0):

$ DISPLAY=:0 gnome-screensaver-command -d

to unlock, and

$ DISPLAY=:0 gnome-screensaver-command -l

to lock.

Alternatively, you can toggle the active state using dbus-send - for example

$ export DISPLAY=:0
$ dbus-send --session \
          --dest=org.gnome.ScreenSaver \
          --type=method_call \
          --print-reply \
          --reply-timeout=20000 \
          /org/gnome/ScreenSaver \
          org.gnome.ScreenSaver.SetActive \
          boolean:false

Source: https://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html#gs-examples

share|improve this answer
    
Unfortunately, neither of these methods unlocked the particular screen lock installed on my system (see screenshot). How can I find which process is responsible for locking the screen anyway? –  krlmlr Sep 5 '13 at 19:22
    
Do the commands return an error? If so please post it. To see if a different screensaver is running you could try ps -fu <username> | grep saver - it is possible that xscreensaver is being used instead of gnome-screensaver, in which case you could try DISPLAY=:0 xscreensaver-command -deactivate. –  steeldriver Sep 5 '13 at 20:31

I had a problem with gnome 3's screen lock (screensaver) being stuck at a blank screen. I managed to work around it by replacing the gnome-shell window manager.

Ctrl+Alt+F1 and log in on a virtual console, then:

pkill -QUIT gnome-shell
DISPLAY=:0.0 gnome-shell -r &

(& Backgrounds the new gnome-shell so you can log out of the virtual console and keep it running. Alternatively use Ctrl+Z to suspend the gnome-shell process, and bg to background it.)

It might not be elegant, but it finally allowed me to get back to my desktop apps without having gnome force me to logout.

share|improve this answer
    
Thanks, I'll try and see if restarting gnome-shell works for me. –  krlmlr Jan 23 at 20:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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