Which command locks screen with lightDM?

27,756

Solution 1

What @wilf said, but maybe you are looking for

dm-tool lock

for a different lock experience. (Because you said with lightDM...)

SECURITY WARNING: avoid using dm-tool lock unless you can verify it works correctly, see:

Solution 2

Just this normally works, but with gdm (Gnome Desktop Manager):

gnome-screensaver-command -l

If this is from a tty, you need to run export display=:0 or something first - you can find the current user session using w.

I think I'll just leave this in for reference

Share:
27,756

Related videos on Youtube

Rumca
Author by

Rumca

Updated on September 18, 2022

Comments

  • Rumca
    Rumca over 1 year

    I used to lock screen with this command, but it stopped working recently, probably after update. I'm running VERSION="13.10, Saucy Salamander". How can I restore this function?

    $ gdmflexiserver
    method return sender=:1.10 -> dest=:1.97 reply_serial=2
    

    I used to invoke this command with openbox keybinding:

    <keybind key="XF86ScreenSaver">
      <action name="Execute">
        <execute>gdmflexiserver</execute>
      </action>
    

    I think it used to work from terminal emulator as well.

    UPDATE: To my surprise, it works again. This might be because of system update.

    method return sender=:1.10 -> dest=:1.71 reply_serial=2
    
  • Wilf
    Wilf over 10 years
    Running this from a tty, and this is for a display manger I couldn't use export display=.., I got this error: Not running inside a display manager, XDG_SEAT_PATH not defined. Also, don't be daft like me and run dm-tool lock in a terminal when you are logged in ;D
  • falconer
    falconer over 10 years
    @wilf I don't know whether he wants to do it from a tty? But with something like XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0" dm-tool lock it should work (as the error suggests). (Check your XDG_SEAT_PATH in the gui with echo $XDG_SEAT_PATH) Though this dm-tool method is kinda broken in my 12.04 as if I lock the screen with it, then switch to tty, then switch back, the screen is unlocked. :D I don't know if this is corrected in 13.10. That's why I said your method is the one and gave an up for it. (Just that method isn't related to lightdm, so maybe the OP is looking for this)
  • Rumca
    Rumca over 10 years
    dm-tool lock has no effect, but it can list Seat0 so I guess it should work.
  • falconer
    falconer over 10 years
    @Rumca I looked here for a bugreport. You said openbox, so I guess you are using Lubuntu, which accordingly to that bugreport also suffers from the problem which I mentioned in my previous comment: The lock can be easily circumvented. I've just read into the conversation under that bugreport and I have the impression that you will have to install a screensaver to lock the screen. Looks like locking of the screen was never secure on Lubuntu and now the developers removed the previous lock possibility because of that.
  • falconer
    falconer over 10 years
    @Rumca But please read the conversation under the bugreport, I had no time to read through it.