GNOME Bugzilla – Bug 469571
automatic login with screen locked
Last modified: 2018-05-24 10:20:44 UTC
I often turn on my laptop and go somewhere else while it starts up. When I get back I have to login and wait for the WM to load before I can actually use my computer. Since my laptop has only one user account I'd like to have this account auto logged in so that when I come back I can just start using it. Of course, I don't want exactly that because it means anybody else could drop by and use my laptop with my user account, so the ideal would be to have a way of doing an automatic login /with the screen locked/, so that one can use the computer only after the user provide its credentials. Would it be possible to implement that in gdm and provide it as an extra option for automatic login on gdmsetup? With some pointers I can probably give it a go. BTW, for now I got this working with an evil hack --a shell script (run in every session) which starts gnome-screensaver and activates it using gnome-screensaver-command.
Why not just use GDM's Automatic Login or Timed Login features as they work, and then also edit your $HOME/.profile or the GDM PreSession script to launch your favorite screensaver on session startup?
Sorry if I wasn't clear, but that's like what I have --I'm using my script (configured to run on every session using gnome-session-properties) together with GDM's Automatic login. Maybe it'd be safer if I called my script from GDM's Presession script as it'd run it before anything else (I hope?)? There may be other people interested on this, though, and that's why I thought about providing an easy way to achieve this (by an option on gdmsetup) rather than manually tweaking shell script files. What do you guys think?
I think this might be a little hard to code in a generic way. Users can use GDM with different session (KDE, GNOME, etc) and with different screensaver programs (gnome-screensaver, xscreensaver, etc). We would need to think through how to provide this in a generic way. But this sort of feature may not be common enough to really warrant making it work via GDM configuration. It shouldn't be that hard to set up via scripting as you done.
Fair enough; I imagined this would be the case. BTW, I tried activating the screen lock from PreSession/Default but it didn't work because it seems I need to do that after the sessreg command is run and it seems to lock on that exact command. In the end I moved it to my .xprofile and it's working nicely.
FWIW, I investigated this a bit during GUADEC and ran into one issue, which is that the screensaver window and newly mapped windows kept fighting each other to be on top of the window stack during login. I posted some information about that here: http://blogs.gnome.org/halfline/2007/07/25/screensaver-extension/ and here: http://mail.gnome.org/archives/screensaver-list/2007-July/msg00006.html I imagine the easiest way to make it lock on startup would be to just set an environment variable GDM_USER_WANTS_LOCKED_SCREEN or some such that would just be a hint for the session. Then we'd make the settings daemon start the screensaver before it does anything else if that environment variable is set. That'd be one way to do it anyway. You don't want to run gnome-screensaver/gnome-screensaver-command directly, because it needs to run on the same message bus as the rest of the session and the message bus isn't started until the session is started.
Also at least last I checked gnome-screensaver was being started 30 seconds into the session. So, that must be fixed too - or maybe already has been. Yeah the environment variable way is probably the best way to avoid races. One way around the session bus problem is for gdm to call ConsoleKit Session.Lock(). This will tell the screensaver to lock the screen. But isn't a good solution here because of the obvious race. Originally I had hoped that we could just start the session in a non-visible xserver but xorg doesn't support that. One other catch with the screensaver approach is that we preclude some a11y support. This kinda pushes in the other direction so to speak. See bugs: #308533 #350716 etc
does Session.Lock() use some screensaver dbus api under the hood to lock the screen? If so, then we can just have ettings-daemon call that if the environment variable is set and rely on activation to start the screensaver early (and if the environment variable isn't set, we wouldn't call Session.Lock() and so the screensaver would get started 30 seconds later)
The CK Session.Lock() method just causes a signal to be emitted on the system bus from the Session object. The method is protected by D-Bus security policy - so GDM could use it but nothing in the user session could. gnome-screensaver just listens for the signal. That said, we should probably add activation support to gnome-screensaver. It was written before that existed :) Then the settings daemon could just call ScreenSaver.Lock().
Bug 546370 is a duplicate of this.
(In reply to comment #5) > I imagine the easiest way to make it lock on startup would be to just set an > environment variable GDM_USER_WANTS_LOCKED_SCREEN or some such that would just > be a hint for the session. Then we'd make the settings daemon start the > screensaver before it does anything else if that environment variable is set. I made a custom xinitrc script (for Xfce4) that looks in the GDM configuration file to check, if automatic login was used for current user, and that way knows to lock screen only in conjunction with automatic login.
*** Bug 546370 has been marked as a duplicate of this bug. ***
(In reply to comment #10) > I made a custom xinitrc script (for Xfce4) that looks in the GDM configuration > file to check, if automatic login was used for current user, and that way knows > to lock screen only in conjunction with automatic login. For what it is worth, the script sample is visible at http://forum.xfce.org/index.php?topic=4831.msg17398#msg17398
I don't know if this information is useful to you, but KDE already has an autolock-on-login feature. Screenshot available[1]. To use it, in the kdm control center module, click the Convenience tab, then check both the "Enable Auto-Login" and "Lock session" checkboxes. ^ [1]. http://www.flickr.com/photos/mind_booster_noori/296300279/
Can anything be done to integrate GDM and the session? How is it done with KDE ?
I'd like to revive this bug in relation to single user systems. After boot we currently show the user list, even when there is only one user. This is clearly suboptimal - making someone select from a list of one is just wasting their time. As an alternative to this, we could simply skip the user list and go straight to password entry. However, automatically logging in and locking the screen seems like a superior option, since it makes the experience of unlocking universally consistent in the single user case. Note that this proposal assumes a few other changes, as described on the wiki [1] and in bug 633015 and bug 679745 . [1] https://live.gnome.org/Design/SystemSettings/UserAccounts#Update_Proposal
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdm/issues/3.