Last active
August 29, 2015 14:21
-
-
Save robotanarchy/5d2cef8ccf5c80115119 to your computer and use it in GitHub Desktop.
Synergy as x2x over SSH replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Author: robotanarchy | |
# Source: http://git.io/synergy-over-ssh | |
# License: Public Domain | |
# | |
# This script is an alterantive to x2x over ssh, for connecting two | |
# machines with synergy over SSH and sharing mouse and keyboard from | |
# the local machine to the remote machine. | |
# | |
# | |
# -------------- Mouse, Keyboard --------------------- | |
# | LOCAL | ----------------> | REMOTE SSH-Server | | |
# -------------- | with display | | |
# | eg. Laptop | |___________________| | |
# '''''''''''''' ______|______ | |
# | |
# In other words the "local" keyboard and mouse will be able to control | |
# the remote display. | |
# | |
# When you're done, press CTRL+C in the open terminal to close the | |
# connection. | |
# make sure this port is available on both machines | |
port=24800 | |
local_display=:0 | |
remote_display=:0 | |
# with a different user: "user@hostname" | |
# with a different port: -p 1337 user@hostname | |
remote_hostname=changeme | |
# start server locally, localhost only | |
# (foreground + &, so it shows important messages) | |
export DISPLAY=${local_display} | |
synergys -d WARNING -a "localhost:$port" -f & | |
# remote: build a reverse ssh tunnel, and connect to the server | |
ssh -R $port:localhost:$port ${remote_hostname} "DISPLAY=:${remote_display} synergyc --no-restart -d WARNING -f localhost:${port}" | |
# cleanup | |
killall synergys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample config (must be installed on the local machine as
/etc/synergy.conf
):