Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(a.k.a. How to switch users without entering password, part II) (see part I)

I've got Ubuntu 9.10 with a user account for my wife, and one for myself. "Wake-from-screensaver" should result in "choose user" without having to enter any password. I know how to do that in Windows, but I'm not good with Linux (yet).

Part of this was answered in my earlier question which helped me get past the login screen without passwords (after booting, and after choosing "switch user"), but once the screensaver kicks in and I wake it up again, the system does not present the "choose user" screen. Instead, it either turns off the screensaver and presents the desktop of the most recent user, or (if the screensaver is set to lock the screen) prompt for the user's password (which can be handily surpassed by clicking the "switch user" button and choosing the same user again).

So, the login ("choose user") screen has been dealt with. How do I make the (any) screensaver return to the login screen at wake, rather than to the current user's desktop? Windows can do this, I'm sure Linux can too - but how?

share|improve this question
So you are logged in. The screensaver kicks in. You want to wake up on the login screen and not be logged in anymore? Because if it is, I'd rather title this "How to wake from screensaver directly to the login screen" instead. For switching users without entering password I suppose you just set the screensaver to lock screen and click on the "switch user" so you're directed to the login screen. The "entering password" or not is not a matter of discussion, as far as I understand this question. – cregox Mar 30 '10 at 19:22
@Cawas: it's not really the best title to describe the current situation, is it? i think that's fixable... – quack quixote Mar 30 '10 at 22:57
I agree, the new title is concise. Thanks. – Torben Gundtofte-Bruun Mar 31 '10 at 11:10

You're making a habit of weird tweaks, aren't you?

Anyway, this one is weird, but interesting. I'm sorry to say I don't have a complete solution, but I found a couple of interesting items that warrant a response. They may give you some ideas of where to go from here.

  • Gnome-Screensaver's FAQ indicates that the screensaver emits a DBus signal when the session's idle status changes:

    Is there a way to perform actions when the screensaver activates or deactivates? Or when the session becomes idle?

    One way is to watch for the D-Bus signals from gnome-screensaver. (...)

    The FAQ provides an example dbus-monitor command:

    dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'"

    Although I believe the interface and member details are outdated for Ubuntu 9.10; the proper values seem to be interface=org.freedesktop.ConsoleKit.Session and member=IdleHintChanged. (See the ConsoleKit documentation.)

    When the screensaver lock is enabled, the IdleHintChanged signal is emitted after the password is entered successfully into the unlock dialogue.

  • The command gdmflexiserver -xnest can be used from the commandline to get back to the login screen. It works within your X session by itself, but you can use dbus-launch to execute it from, say, an SSH session:

    DISPLAY=:0 dbus-launch gdmflexiserver -xnest

    That "activates" the GDM login screen, without logging the current user session out, just like the "Switch User..." menu option does (at least as far as I can tell).

The trick will be to find some way to glue these two together. It seems to me that what you'd want to do is basically:

  1. Disable the screensaver's lock;
  2. Register a listener with DBus that listens for the IdleHintChanged signal on all sessions;
  3. Have the listener execute the gdmflexiserver command when it detects the signal.

Step 1 is needed so you don't get the password prompt. If step 2 works properly and step 3 kicks off, you'll get the login window anytime your system comes out of the screensaver. But step 2 is what I'm not sure how to do.

share|improve this answer
if i come up with something clever for step 2 i'll edit it in, but this may give you something to work on in the meantime. – quack quixote Mar 30 '10 at 10:58
On the mac, when you lock the screen there's an option to "change user" which goes to login screen by default. If the other user have no password, you can unlock the screen without needing one. This is not a weird question at all. – cregox Mar 30 '10 at 19:15
@Cawas: yeah, that's not an especially serious statement. – quack quixote Mar 30 '10 at 23:03
I don't think this is a weird tweak. I'm surprised that a multi-user system like Linux doesn't have that feature built-in since forever. Especially considering that both Mac OS and Windows have this feature. I'm also surprised that the solution is so roundabout, but then again I'm just a simple user with no programming experience; perhaps it's the best solution this way. – Torben Gundtofte-Bruun Mar 31 '10 at 11:13
Now I don't know what to do about the bounty. I guess I'll accept this answer, but I feel unable to really try if it works. I thought there would be a setting "in there somewhere" to trigger what I want. Thank you for your very elaborate explanation! – Torben Gundtofte-Bruun Mar 31 '10 at 11:15

I understand that this question is for years ago, but some users may be still searching for this.

One may prefer Ubuntu login screen to lock screen at wake (for example not to show even the wallpaper on an encrypted home), and this is possible in Ubuntu 12.10 and 13.04 (not sure about earlier versions).

So to do this, open Dconf Editor (pre-installed on Ubuntu 12.10+) and go to:

org > gnome > desktop > screensaver

Enter the command dbus-launch gdmflexiserver -xnest for the variable embedded-keyboard-command. Then check embedded-keyboard-enabled for the same schema.

share|improve this answer

I'm going to have to provide my own answer here, which is that there apparently is no (easy) solution to what I'm asking for.

A solution potentially exists but it is not complete and requires deep Linux understanding - as can be seen in the first answer. So it's not an out-of-the-box answer I would feel right about accepting as "the" answer.


How do I make the (any) screensaver return to the login screen at wake, rather than to the current user's desktop?

Answer: You can't.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .