SSH Keygen Infos

I havent’t wrote in a while. To keep it short: I’m still alive.
This is just a short note on ssh keygen and ssh-copy which I was not aware of.

Let’s assume you have your keys an need to change the passphrase:
cd ~/.ssh/
(keys can be ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub)

ssh-keygen -f id_dsa -p

And copy the key to remote host:

ssh-copy-id -i USER@REMOTE_HOST

That’s it πŸ™‚ now you can connect to the remote machine without hassle.

ssh USER@REMOTE_HOST

iTunes Sharing over ssh

Today I realized that I had not a single song on my notebook hard disk. Thanks to Last.FM πŸ™‚
Unfortunately “Simplify Media” has been adopted by Google Inc. and they do not offer a similar service yet. So I needed a solution to stream my iTunes from home to the office. If found a great solution by “Robert Harder” which works like charm. (source).
This is the bash script:

#!/bin/sh
dns-sd -P "Home iTunes" _daap._tcp local 3689 localhost.local. \ 
127.0.0.1 "Arbitrary text record" &
PID=$!
ssh -C -N -L 3689:localhost:3689 username@dyndns_name.dyndns.org
kill $PID

synergy, ssh and port forwarding

How to use synergy over ssh with a gateway server, or
How to make port fowarding over a gateway ?

Ok then, someone last week showed me the great tool “synergy”. With it, two ore more computers can be controlled by one keyboard and one mouse. So that’s nothing new.
The nice thing is that if you move your mouse over the boarder of screen 1 if will appear on screen 2 just like this screen was connected to your computer.
It’s working great and I wanted to have this everywhere my MacBook goes.
Setup and Config is real easy and descibed at http://synergy2.sourceforge.net/

The problem is that it’s build upon a server client architecture and you need to have a direct connection between your server and your client. Yes well that should be no problem but I’m working in an office where the networks for hosted computers and the computers ones bring inΒ  are seperated. The only option to get a connection from my macbook to the linux machine I’m sitting right next to, is a connection over a gateway Server that’s somewhere else.
So ssh from my macbook -> gateway
and then from gateway -> to office local linux box
But if i do it this way I won’t be able to establish a direct connection. After some research on the net I came up with this:
Box1 = MacBook
Box2 = Gateway Server
Box3 = office linux box

1st of all start the Server on Port 8033 (or sth. else), Type this on bash in BOX3

synergys -a localhost:8033 -f –config ../conf/synergy.conf

then make a port forwarding from Box2 port 8033 to Box3 port 22. Type this on bash in BOX1

ssh -L 8033:BOX3:22 cb0@BOX2

Then make a port forward from localhost port 24810 to port 8033 on localhost which redirects us directly to Box3. Type this on bash in BOX1

ssh -p 8033 -v -f -N -L localhost:24810:localhost:8033 cb0@localhost

Now on Box1 type this to connect synergy to localhost on port 24810 which redirects it to Box 3.

./synergyc -f localhost:24810

thats it.
Hope you enjoy your new productivity with synergy πŸ˜‰

A nice project I thought of was to teach my macbook to atomatically connect to a specific server dependent on the enviroment i’m in. This should somehow be possible using apple script but at the moment I have no Idea how.