Announcement

Collapse
No announcement yet.

Lock screen from command line

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lock screen from command line

    I want to be able to lock the screen on my PC remotely, via ssh.

    All of the information that google has turned up is outdated or just doesn't work.

    Can anyone tell me how this can be accomplished?

    #2
    Does this work?
    Code:
    DISPLAY=:0 qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.Lock
    Edit: tested here, works. On Kubuntu 15.04.
    Last edited by SteveRiley; Jun 25, 2015, 11:36 PM.

    Comment


      #3
      Originally posted by SteveRiley View Post
      Does this work?
      Nope. That's the command I keep finding everywhere but this is what happens when I enter it:

      Code:
      Service 'org.freedesktop.ScreenSaver' does not exist.

      Comment


        #4
        What's the output of
        Code:
        qdbus | egrep -i 'save|screen|lock'

        Comment


          #5
          Ah, figured it out.

          Code:
          /usr/lib/kde4/libexec/kscreenlocker_greet --immediateLock
          Works like a charm.

          Comment


            #6
            Nice.

            For 15.04 and greater, the binary is in a new location.
            Code:
            /usr/lib/x86_64-linux-gnu/libexec/kscreenlocker_greet --help

            Comment

            Working...
            X