I use synergy. I would like to synergy to start as soon as I turn on my computer. How do I do that?
To start synergy
, the command is:
synergys --config ~/.synergy.conf
For newer version of Ubuntu that use lightdm.
I have successfully done the following for running the synergy client for the login screen, and after I login. It is much simpler than the other answers, IMHO.
edit /etc/lightdm/lightdm.conf as root.
sudo vi /etc/lightdm/lightdm.conf
add the following line to the bottom of the file.
greeter-setup-script=/usr/bin/synergyc <ip/host>
restart lightdm. (it is better to do this from a terminal or ssh session)
sudo /etc/init.d/lightdm restart
The main article is on Synergy's sourceforge site: Starting synergy automatically
Here is a lead-in to the article... there is too much detail to put it all here:
Synergy requires an X server. That means a server must be running and synergy must be authorized to connect to that server. It's best to have the display manager start synergy. You'll need the necessary (probably root) permission to modify the display manager configuration files. If you don't have that permission you can start synergy after logging in via the
.xsession
file.
To start Synergy once you have logged into your X-session.
Main Menu - System - Preferences - Startup Applications
[ Add ]
Name: synergys
Command: synergys --config ~/.synergy.conf
Comment: synergys
If you have problems with the ~/
, try $HOME/
or as a last resort use /home/your_username/
I just checked my notes... When I connected from Windows to a Linux box , my command was:
/usr/bin/synergyc 192.168.1.16
... maybe the full path is needed.
You are running Synergy as a server, I was running it as a client.. but that shouldn't effect the auto startup.
For Ubuntu 14.04 (and possibly others, I think 14.04 is the first build that lightdm was changed to this format, but this will work on any build that uses this setup) its simple you just need to edit 50-ubuntu.conf to get Synergy prior to lightdm:
sudo nano /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
For Client add this line:
greeter-setup-script=/usr/bin/synergyc <OPTIONS> <SERVER HOSTNAME>
For Server add this line:
greeter-setup-script=/usr/bin/synergys -c <CONFIG FILE>
Save files after edit and reboot (I know you can restart service rather than reboot but I perfer to reboot).
For Server or Client just insert the command that you would enter in terminal to get it to launch with the appropriate options ect...
So say I normally execute the command below in terminal on my client machine to run Synergy.
synergyc -n XBMC 192.168.1.99
All I need to do to run Synergy pre lightdm is add the line below to 50-ubuntu.conf
greeter-setup-script=/usr/bin/synergyc -n XBMC 192.168.1.99
Hope this helps, because the Synergy docs are a bit out of date. Enjoy!
I tried Kevin's answer, and while it seemed to work at first but I then started getting some really wacky behavior. I tried using session-setup-script to kill root's synergy and start it as the user in ~/.xprofile, but the wackiness continued. Finally gave up, removed the entries from lightdm.conf and kept the starting as a user in ~/.xprofile after logging in directly. Not perfect, but at least the weird behavior stopped.
I have successfully got this to work using Kevins method above. My Ubuntu machine (12.04) is configured as the client and my Windows machine (Win7) is the server.
run
sudo vi /etc/lightdm/lightdm.conf
add
greeter-setup-script=/usr/bin/synergyc <ip>
Save and reboot.
I had to specify the IP, it wouldnt work with hostname (the Ubuntu client is not on the windows domain) even though I can communicate with the windows machine via hostname once I had have logged into the Ubuntu machine)
EDIT: Updated with better practices related to not mucking with files in /usr/share that will get clobbered on package updates
I have used the same steps as other answers, but I typically run via a script, and I enabled encryption (even though it is NOT airtight, but always improving).
Note: For at least 14.04 use /etc/lightdm/lightdm.conf.d/ instead of the one in /usr/share from JohnRB's answer
edit /etc/lightdm/lightdm.conf or a synergy specific file in lightdm.conf.d as root.
sudo nano /etc/lightdm/lightdm.conf
or
sudo nano /etc/lightdm/lightdm.conf.d/20-synergy.conf
add the following lines to the bottom of one of the files. Don't forget to chmod +x the script wherever you keep it.
greeter-setup-script=/home/<user>/<pathToScript>/start-synergy.sh
session-setup-script=/home/<user>/<pathToScript>/start-synergy.sh
Absolute minimum if you don't want to use a script:
/usr/bin/synergys :24800
Synergy searches the following places to find its config if no path is provided and you MUST have a valid config or it will fail.
/home/<your_user>/.synergy.conf
/etc/synergy.conf
Restart lightdm. (it is better to do this from a terminal or ssh session)
sudo /etc/init.d/lightdm restart
#!/bin/bash -x
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys --name $HOSTNAME --crypto-pass <your_hashed_pass> --log /var/log/synergy.log --config /home/<YOUR_USER>/.synergy.conf --address :24800
Kill synergy so we don't get multiple copies running between reboots
/usr/bin/killall synergys
Wait until the process actually dies and then pause a split second
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
This is the minimum I'd recommend
/usr/bin/synergys --name <hostname_or_alias> --address :24800
Path to your saved config
--config /home/<your_user>/.synergy.conf
To generate a hashed password if you want to use crypto run this:
echo -n <yoursynergypassword>|md5sum
Output will be like below, remove the space dash ' -' from the end:
0a137b375cc3881a70e186ce2172c8d1 -
Input it like:
--crypto-pass <your_hashed_pass>
Logging for seeing if there are handshake errors or anything else wrong
--log /var/log/synergy.log