Posts Tagged ‘ Ubuntu

Securing Synergy

At work, I have several computers on my desk, but I prefer to only use one mouse and keyboard to control all of them. To accomplish this, I use Synergy. The more recent versions of Synergy come with the ability to perform encryption on the connections through Synergy itself, but I did not feel it adequate enough or easy enough to use for my needs. Instead, I run Synergy on my machine which has the keyboard and mouse attached to it, then on my client machines, I tunnel the remote server’s synergy port to the local machine, and connect locally, This tunnels all Synergy traffic through SSH transparently, and is extremely secure. I like this level of security because often times, I am typing personal, sensitive, or confidential information on one of the client machines using the server’s keyboard.

In my setup, is the Synergy server. All SSH is done through public key encryption to make the connection painless.
Here is the script I use:

#!/bin/bash -x

function clean()
    for job in `ps -eo pid,args | grep ssh | grep 24800 | grep -v grep | awk '{print $1}'`
        kill -9 $job

trap clean SIGINT

ssh -f -N -L
synergyc -f localhost

I hope this helps someone else looking for an easy way to secure down Synergy.

Auto installation of ssh public keys

Over the past few months, I’ve been writing little shell scripts here and there that make it just a bit easier to get my day to day work done. I thought I would post one of them here in case it might be beneficial to others as well.

I work a daily job where I am constantly using ssh to access many different remote machines all across the world. Since different machines can have different passwords and the like, I prefer to use public key authentication when possible to avoid this headache. The issue is, for each new machine I access, I used to have to manually install my pubkey on it to use public key authentication in the future. Even though Ubuntu has a shell script that ships with it called ssh-copy-id which handles the work for me, I knew that I could do better. Here is what I came up with:


#!/bin/bash -x

/usr/bin/ssh -o PreferredAuthentications=publickey -o PasswordAuthentication=no -n $@ &> /dev/null
if [ $? -ne 0 ] 
    ssh-copy-id $@
exec /usr/bin/ssh $@

What this script does is first check if my pubkey is installed on the remote machine. If not, it runs the ssh-copy-id script to install it. This will prompt for the password, then install my public key. After that, a normal ssh session is started which, if everything worked properly, will use pubkey authentication to log me in. Perfect! The exec was necessary so that konsole (my preferred terminal) would realize I was in a remote session and update the tab label properly. I also had to change the shell script /usr/local/bin/ssh-copy-id near the end to have it use /usr/bin/ssh rather than just “ssh” otherwise it would recursively infinitely loop.

Pidgin-closeoffline: a plugin for Pidgin to close offline conversation tabs

I recently took some time to learn some of the inner workings of Pidgin and libpurple, and along the way I decided to write a plugin that would provide a feature that I was really missing from native Pidgin. There are often times where I would have my Pidgin open for days at a time, and would accumulate huge numbers of conversation tabs open, with many of those chat partners signed offline. I didn’t want to close all the tabs, only the offline buddies, and I didn’t see a way to do this in Pidgin. So I took a dive into the APIs for Pidgin and libpurple and came up with this little plugin that adds an item to the right click context menu of the tab bar in a conversation window that will close all offline buddies. Right now, I have only tested it working on Ubuntu 12.04.1 32 bit and 64 bit, but I assume it would work other places too. To install the plugin, first download it from:

Extract that folder, then open a terminal in that directory and run:

# ./

This should take care of setting up all the dependencies, compiling the plugin, and then installing it to the local user’s plugin directory.

If you care to browse the source code, its available in the downloaded zip file as well as in the github repository at: