Product: Synergy 1.17.0 and above
Operating System: Linux
How to run Synergy automatically after login - create a user-level systemd service
- Open the terminal
- Run the following command to find and copy the core launch command:
-
ps aux | grep synergy-client
-
nano ~/.config/systemd/user/synergy-session.service
- Copy and paste in the following script:
[Unit]
Description=Synergy Client (User Session)
After=graphical-session.target network.target
[Service]
ExecStart=/usr/bin/synergy-client -f --no-tray --debug INFO --enable-crypto --name YOUR_CLIENT_NAME --sync-language YOUR_SERVER_IP:24800
Restart=on-failure
[Install]
WantedBy=default.target
Press Ctrl+O to save, and Ctrl+X to close nano
Now enable the service:
-
systemctl --user daemon-reexec
-
systemctl --user daemon-reload
-
systemctl --user enable synergy-session
Note - remove the --enable-crypto and --sync-language if you don’t have those settings enabled.
To run Synergy at the login screen on a Linux client
Step 1: Identify Synergy Client Settings
On your working Synergy client session (after login), run:
ps aux | grep synergy-client
Take note of the command flags, an example:
/usr/bin/synergy-client -f --no-tray --debug INFO --name linuxubuntu22 --sync-language 192.168.86.82:24800
You'll use this exact command in the login wrapper script.
Step 2: Create the Wrapper Script
sudo nano /usr/local/bin/synergy-login.sh
Copy and paste the following script(adjust IP and hostname):
#!/bin/bash
LOGFILE="/var/log/synergy-login.log"
echo "[$(date)] Starting synergy-login.sh" >> "$LOGFILE"
export DISPLAY=:0
export XAUTHORITY="/run/user/$(id -u gdm)/gdm/Xauthority"
# Wait for X session to be ready
while [ ! -f "$XAUTHORITY" ]; do
echo "[$(date)] Waiting for XAUTHORITY..." >> "$LOGFILE"
sleep 1
done
sleep 2
echo "[$(date)] XAUTHORITY found, launching synergy-client" >> "$LOGFILE"
while true; do
/usr/bin/synergy-client -f --no-tray --debug INFO --enable-crypto \
--name YOUR_CLIENT_NAME --sync-language YOUR_SERVER_IP:24800 >> "$LOGFILE" 2>&1
echo "[$(date)] synergy-client exited. Retrying in 5s..." >> "$LOGFILE"
sleep 5
done
Replace YOUR_CLIENT_NAME and YOUR_SERVER_IP with your actual values.
Make it executable:
sudo chmod +x /usr/local/bin/synergy-login.sh
(Optional) Step 3: Configure Trusted Server Fingerprint for TLS
1. Get the trusted fingerprint (on the client after accepting the server):
cat ~/.synergy/SSL/Fingerprints/TrustedServers.txt
Example:
YOUR_SERVER_IP:24800 sha256:ABCDEF123456...
2. Make this accessible to root (for login screen use):
sudo mkdir -p /root/.synergy/SSL/Fingerprints
sudo ln -s /home/YOUR_USERNAME/.synergy/SSL/Fingerprints/TrustedServers.txt \
/root/.synergy/SSL/Fingerprints/TrustedServers.txt
sudo chmod o+r /home/YOUR_USERNAME/.synergy/SSL/Fingerprints/TrustedServers.txt
Replace YOUR_USERNAME with your actual Linux username.
Step 4: Create systemd Service
sudo nano /etc/systemd/system/synergy.service
Copy and paste the following script:
[Unit]
Description=Synergy Client at Login Screen
After=gdm.service network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/synergy-login.sh
User=root
Restart=always
RestartSec=5
[Install]
WantedBy=graphical.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable synergy
sudo systemctl restart synergy
Step 5: Reboot and Test
Reboot to test:
sudo reboot
After reboot:
- Wait at login screen
- Switch to TTY (Ctrl + Alt + F3)
- Log in
- Check the log:
sudo tail -n 30 /var/log/synergy-login.log
You should see:
[INFO] crypto enabled
[INFO] connected to server