Which command locks screen with lightDM?
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:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740163
- https://bugs.launchpad.net/ubuntu/+source/lxsession/+bug/1205384
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
Related videos on Youtube
Rumca
Updated on September 18, 2022Comments
-
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 over 10 yearsRunning this from a
tty
, and this is for a display manger I couldn't useexport display=..
, I got this error:Not running inside a display manager, XDG_SEAT_PATH not defined
. Also, don't be daft like me and rundm-tool lock
in a terminal when you are logged in ;D -
falconer over 10 years@wilf I don't know whether he wants to do it from a
tty
? But with something likeXDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0" dm-tool lock
it should work (as the error suggests). (Check your XDG_SEAT_PATH in the gui withecho $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 totty
, 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 over 10 years
dm-tool lock
has no effect, but it can list Seat0 so I guess it should work. -
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 over 10 years@Rumca But please read the conversation under the bugreport, I had no time to read through it.