Android Remote Start Desktop
After getting my server setup again I've been messing with ssh and all that when it struck me, a clever idea.
My router runs Tomato[1] which has a built in SSH server[2] and my phone just happens to be an android based phone which has ConnectBot[3]. My router also supports wake on lan[4] and this got me thinking a little bit. What if I automated that somewhat into a sort of "remote start" button on my phone for my desktop.
So first thing I did was look up what flavor of WOL client my router used. By default I believe Tomato comes with ether-wake[5]. So I just setup a session on connectbot that ssh's into my router at home and added ether-wake ##:##:##:##:##:## && exit in post-login automation for the session.
Now, this was great and all but it still required me to enter my password every single time and hit enter as soon as it connected, as it only fills in the command it doesn't automatically execute it[6]. The next thing that came to mind was just setting up a key pair for key authentication with ssh which would bypass having to enter the password every single time. All I would have to do at this point was enter the password once to unlock the key and then I could just log in whenever I needed to.
After generating the key pair and added the public key to the list of authorized keys for ssh on my router everything worked exactly as I intended. So just for a finishing touch I added a shortcut to my phone's home screen labelled: Wake Audbox[7]. Now whenever I want to remote start my system I just hit that button[8] and then when it connects and enters the command and then I just hit enter. After hitting enter it wakes my system and exits the session.
- As you may have read in a previous post or two. [↩]
- Much like DD-WRT and almost all of the other custom firmwares you can get for most routers these days. [↩]
- ConnectBot: a SSH client for the Android platform. [↩]
- Wake-on-LAN [↩]
- I'm using TomatoUSB which has been modified somewhat and I'm not sure if this is part of the modifications or not, though I doubt that it is. [↩]
- Which doesn't really seem all that intuitive to me. [↩]
- Audbox is the name of my desktop. [↩]
- Assuming that I've got the key unlocked otherwise it'll just ask me for my password. [↩]
Socks FTW!
Well, not the fabric-y variety of SOCKS, the proxy variety. My friend Pete mentioned at some point a few weeks ago that I was "doing it the wrong" when I was doing some SSH tunneling to my FreeNAS server.
The original setup involved tunneling port 80 and a few other random ports for things like the web interfaces of the DAAP and UPnP servers. Which was a bit of a pain to add each time I wanted to tunnel the ports on a new computer whether it was my laptop, desktop or workstation. I could save the profile and just use that though it was a pain to be thorough enough to include all the ports I'd need. At the time Pete mentioned something about a SOCKS proxy which I didn't really understand and originally thought it would involve installing new software somewhere which I didn't really want to do at the time.
After a little bit of research later I found that one of the most common SSH servers OpenSSH has a built in SOCKS proxy. This is great because it meant installing no new software or even any new configurations for that matter. In Putty I discovered it was as simple as adding a dynamic port of my choice (1080 is probably best here since it's the default SOCKS proxy port). Once I did this I installed FoxyProxy plugin for firefox and was on my way to a quick and simple proxy to any service I desired on my FreeNAS server.
To do this from a command line is just as simple:
1 | ssh -D1080 user@example.com |
A quick way to test this is to go to a "what is my IP" site of some variety then connect to the server with the SOCKS proxy enabled and setup your browser with that proxy and reload the page, if your external IP changes to the external IP of the server you just ssh'd into then you've done it.

