12

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
Rumca
  • 327
  • 1
  • 2
  • 8

3 Answers3

24

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:

akostadinov
  • 769
  • 2
  • 7
  • 9
falconer
  • 14,868
  • 3
  • 46
  • 67
  • 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 – Wilf Jan 19 '14 at 13:45
  • 1
    @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) – falconer Jan 19 '14 at 13:53
  • `dm-tool lock` has no effect, but it can list Seat0 so I guess it should work. – Rumca Jan 19 '14 at 14:09
  • @Rumca I looked [here](https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1205384) 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 Jan 19 '14 at 14:45
  • @Rumca But please read the conversation under the bugreport, I had no time to read through it. – falconer Jan 19 '14 at 14:45
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

Wilf
  • 29,694
  • 16
  • 106
  • 164
0

Install light-locker. The command:

dm-tool lock

or:

light-locker-command -l

Should then lock the screen, using the lightdm greeter as the lock-screen. If you try to switch back with the tty you will just get a locked screen with a message and then get redirected to the greeter after a few seconds.

Lestibournes
  • 111
  • 5