Rafael A. Baragano

Ubuntu 16.04 - Start synergy before login

8 posts in this topic

Could someone please create a tutorial on how to do this. I cannot use the server's mouse/keyboard on login, which is kind of annoying.

 

I know it is possible, but how?

 

Thanks in advance...

Share this post


Link to post
Share on other sites

I haven't been able to get synergy pre-login on Linux to work in some time. You used to be able to add commands the desktop startup scripts, but it hasn't worked for me with lightdm or gdm on later arch, fedora or ubuntu versions.

 

I don't know if this will work for you, but I stopped messing with trying to get synergy to start with the desktop manager and did the following:

 

1. set synergy to autostart with my session

2. set the screen to lock immediately on login (I use slock)

3. set my user to autologin

 

Then you can use the synergy server to unlock and use the session.

Share this post


Link to post
Share on other sites

I messed around with this today. If you're using lightdm (I think that's default for newer Ubuntu releases), you can do the following.

Make a script to start synergy and make a script to stop synergy. Tell lightdm to run the scripts by editing the lines in /etc/lightdm/lightdm.conf:

#display-setup-script=
#session-setup-script=

to

display-setup-script=/usr/local/bin/display-setup.sh
session-setup-script=/usr/local/bin/display-stopped.sh

Basically, you tell lightdm to start synergc as root for the login then kill synergy as root when it sets up the user session after login.

As root...

Make a couple of scripts:

h=
# Start synergyc
echo "/usr/bin/synergyc $h" > /usr/local/bin/loginstart.sh
# killall synergyc but don't error if it's not running
echo "killall synergyc || true" > /usr/local/bin/loginstop.sh

 

Edit /etc/lightdm/lightdm.conf

sed -i -e '/^#display-setup-script=/display-setup-script=\/usr\/local\/bin\/loginstart.sh/' /etc/lightdm/lightdm.conf -e 's/^#session-setup-script=/session-setup-script=\/usr\/local\/bin\/loginstop.sh/' /etc/lightdm/lightdm.conf 

 

See https://wiki.ubuntu.com/LightDM

Share this post


Link to post
Share on other sites

Thank you Alex Copeland for you post, it helped me a lot.

In addition, there are some other changes were required in my setup with Lubuntu 16.04

I'll replicate steps mentioned by Alex and add the missing steps for my case.

# Run everything as ROOT user
# copy the current synergy SSL configuration to root user
# synergy should be already up and run, configured etc..
cp -R ~/.synergy /root/

# create /etc/lightdm/lightdm.conf.d/synergyc.conf
echo "[SeatDefaults]\ndisplay-setup-script=/usr/local/bin/loginstart.sh\nsession-setup-script=/usr/local/bin/loginstop.sh\n" > /etc/lightdm/lightdm.conf.d/synergyc.conf

# create /usr/local/bin/loginstart.sh
echo "/usr/bin/synergyc -f --no-tray --debug INFO --log /var/log/synergy-start.log --name <your pc name> --enable-crypto <your server ip>:24800 || true &" > /usr/local/bin/loginstart.sh
chmod +x /usr/local/bin/loginstart.sh

# create /usr/local/bin/loginstop.sh
echo "killall synergyc || true" > /usr/local/bin/loginstop.sh
chmod +x /usr/local/bin/loginstop.sh

 

Share this post


Link to post
Share on other sites

And, thank you, Kostanos.  Your post helped me out, too.

I typically run Arch, and the default config doesn't include the /etc/lightdm/lightdm.conf.d/ directory.  When I looked at the Arch docs, I missed reference to the conf.d -- if there was one.

The way you did things using the conf.d instead of messing with the lightdm.conf file is a lot cleaner.

Share this post


Link to post
Share on other sites

synergy 2 has autostart, you should have it available in your downloads, if you are running a non supported distros check things like the AUR or extract the files yourself and put them in the right place.

Share this post


Link to post
Share on other sites
1 hour ago, jaap aarts said:

synergy 2 has autostart, you should have it available in your downloads, if you are running a non supported distros check things like the AUR or extract the files yourself and put them in the right place.

What exactly do you mean by Synergy 2? The current downloadable version seems to be Synergy 1.8.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now