Skip to content

Instantly share code, notes, and snippets.

@f1yn
Created November 14, 2022 05:36
Show Gist options
  • Select an option

  • Save f1yn/2184f63b0e257e7da460b8c3d6bd1e65 to your computer and use it in GitHub Desktop.

Select an option

Save f1yn/2184f63b0e257e7da460b8c3d6bd1e65 to your computer and use it in GitHub Desktop.
Enable Synergy (correctly) at login on any Linux using GDM3

These commands come AS IS, WITH NO WARRANTY. I AM NOT RESPONSIBLE IF YOU BORK YOUR SYSTEM

Synergy on Linux - It's great when it works, but it's also a pain because most guides are intended for Ubuntu 18, which is absolutely useless now. Here is how I was able to setup Synergy at login on a Pop_OS 22.04, but should ALSO work for ANY distribution using GDM3 as it's login manager (i.e Fedora and/or Ubuntu).

Step 1

Install synergy. Make sure that synergyc is installed first (included in deb or rpm)

Step 2

Connect to your host system while logged in. This will populate the known host fingerprints in $HOME/.synergy/SSL - which we 100% need to make sure that a headless Synergy instance can also use the same fingerprints later.

If you can't connect from the desktop, good luck connecting from GDM

Step 3

Add the login service for GDM. Replace [your-synergy-client-id] and [your-synergy-host-ip-or-hostname] respectively with the values already used by your client Synergy

sudo vim /usr/share/gdm/greeter/autostart/synergy.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Synergy
Comment=-
Exec=/usr/bin/synergyc --name [your-synergy-client-id] --enable-crypto [your-synergy-host-ip-or-hostname]
Icon=synergy
Terminal=false
Categories=-;
Keywords=-;

Step 4

Copy your Synergy SSL to the virtual GDM directory using root. The GDM3 process is virtualised using a fake root user, which has it's $HOME located at /var/lib/gdm3

cd $HOME
sudo -s
cp -r ./.synergy/ /var/lib/gdm3/.synergy/
exit

Step 5

Make sure that the GDM synergy process terminates once a valid user logs in via the GDM greeter

sudo vim /etc/gdm3/PostLogin/Default
#!/bin/sh
# purge all synergyc processes
/usr/bin/killall synergyc
# then wait until it's been successfully  purged
while \[ $(pgrep -x synergyc) \]; do sleep 0.1; done

Step 6

Setup Synergy to autostart. You can do this with your desktop manager, but most allow you to do it as follows:

vim ~/.config/autostart/synergy.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Synergy
Comment=-
Exec=/usr/bin/synergyc --name [your-synergy-client-id] --enable-crypto [your-synergy-host-ip-or-hostname]
Icon=synergy
Terminal=false
Categories=-;
Keywords=-;

Reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment