Remote-Linux-Unlocker icon indicating copy to clipboard operation
Remote-Linux-Unlocker copied to clipboard

Fix unlocker_daemon.py for Ubuntu 18.04 and onwards.

Open appositeit opened this issue 5 years ago • 0 comments

From 18.04 Ubuntu changed back to the Gnome desktop, and a bunch of the tooling used in the unlocker-daemon.py broke.

To fix this we need to:

  • Identify the user who's session we want to unlock
  • Get the DBUS_SESSION_BUS_ADDRESS for their dbus.SessionBus()
  • seteuid to their uid

The original script looks for the first 'real' user in /etc/shadow. I look for the first process run by a non-daemon user process with a DBUS_SESSION_BUS_ADDRESS in their environment and use that BUS_ADDRESS and user's uid to seteuid.

The orginal script shells out to control the screensaver, I've modified it to use python dbus commands to query screenlock status and lock/unlock the screensaver. I think it should work with various window managers, but it's only been tested on gnome. Behaviour is undefined if there are several user sessions with window managers running.

appositeit avatar Aug 08 '19 13:08 appositeit