Category Archives: hardware

Setup SSH on a home linux server for remote Node development

Hello again, today I’m going to run through whats required to get a node server running from home.

This may seem like an odd thing to do, but if you do a lot of remote work/hackathons/contract work you may find that the facilities to perform a internet accessible demo are quite lacking.

Firstly, we take our old laptop/micro pc/old pc and install the latest version of Ubuntu (15.10 at time of writing). However, we don’t need the desktop experience so we’ll just install the server installation. You’ll need to do this in front of the machine (although it is possible to roll a SSH enabled distro, but that is far from Quick ūüėČ ).

After installing Ubuntu and setting a static IP, log in and install openSSH..

Ensure that you follow the instructions in the link below, and alter the listening port to something other than 22 (e.g. 36622)

So, now you should be able to access your ssh prompt via  a local callback:

ssh -v localhost

Lets add node and a simple express application

sudo apt-get install node npm

Once node is installed, create a folder for your server

mkdir nodetest

Then browse to your new folder and initialise node

cd nodetest
npm init

Now add the http module

npm install http -save

(as ever, use sudo if none of this works or chmod/chown your folder)

And add the following code to a new javascript file called quickanddirty.js to create a simple http listener on port 8090

var http = require('http');
var server = http.createServer(function(req,resp){
    resp.end("Welcome to your Node server");
server.listen(8090, function(){
    console.log("Your server has started", 8090);

Test your server out by running node with the javascript file

node quickanddirty.js

You will see that the server has started, and is listening to port 8090. Leave it on as we move to accessing the box remotely.

Note: you can use cURL to check the response also if you are feeling unstoppable ūüėČ

So, to recap, we have an Ubuntu linux box running openSSH and Node. Happy times, happy times.

At this point, as we already assume you have a home broadband connection, we will connect the box to the outside world.

As broadband supplier software differs I’ll try and explain what you need to do both on and away from the box.

Firstly, you need a way of mapping the often shifting IP address of your router with a static dns entry. This is done using a dynamic DNS service such as dynDNS (there are others available, but will generally require installing perl scripts on your linux box to keep the dynamic dns entry up to date).

So, register an account with DynDNS (others are available) and choose a subdoman. Note: Don’t make the name identifiable to yourself..lets not give hackers an easy ride ūüėČ

Once you have your subdomain, you need to create a mechanism to update the dynamic service so calls to the domain get passed to your router IP address.

Both the SKY and virgin broadband devices have areas to select the Dynamic DNS service. Note: Advanced users can configure the dynamic dns update from the linux box

Once it is selected, you’ll enter your account details for the Dynamic DNS service and your router will periodically let DynDNS (or whoever) know the current IP address of your router. This allows you to ssh in on a domain and always get to your router.

Once the dynamic dns is set up you’ll generally need to set up a port forward via the routers firewall from the entry point of your router to the¬†linux server’s openSSH port number (as chosen¬†previously), 36622.

With the Virgin router, you will need to buy another router and put your Virgin box into modem mode, which will simply pass the connection to your other router for dynamic dns, port forwarding and firewall setup. The full instructions for doing this can be found online “virgin wifi modem mode dynamic dns“.

The Sky router is more friendly, with services to set up the port to listen to, then firewall settings to point it to your box.

As I said previously, you don’t need to use DynDNS through the broadband¬†box, just ensure that the port is available and you have a method of updating the Dynamic DNS entry in your provider with your router IP.

The clevererer of you reading will have realised that you don’t need dynamic dns at all if you know the current IP of your router, so as a last resort, you can use that to connect to SSH.

Which leads us to, connecting to your server.

With your server running, hop onto another network, such as your phones, using a different computer and try to connect to your SSH server.

In terminal type the following, taking “nodeuser” as the user created on your linux box, and “” as the dynamic dns entry (you could use the router IP instead also),¬†and the port number of 36622 we chose earlier

ssh -p 36622

You should be able to log in to your server. Verify by browsing to your nodetest folder.

So, we can access your server via openssh, but how can we access the node instance running at 8090. Simples. We tunnel to it.

type “exit” to exit from the openSSH session, then create a new session with added tunneling. To explain how tunneling works in one easy sample, I am going to tunnel into port 8090 on my SSH connection via a local port of 9999.

ssh -p 36622 -L -N

or, if that seems to not work correctly replace the second dynamic domain with your servers actual name.

ssh -p 36622 -L 9999:randomchicken47svr:8090 -N

Now you’ll be able to browse to the localhost port of 9999 in a web browser, and see the response from your Node server via tunneling.

We have used tunneling instead of just opening a port direct to your node port¬†as it increases security. If you’re opening ports for multiple services it increases your attack surface, meaning that an attacker has more things to attack to gain access to your network. Its much safer to have a single fortified SSH accesspoint on a non-standard port.

Be careful, you may get addicted to SSH tunneling, as it can enable you to do some amazing things.. But bear in mind, the tunnel uses your home bandwidth allowance if you have one.

Take care,


Quick N Dirty – Oculus Rift 0.7 hijinks

Well, having obtained an Oculus in a hackathon the other month, I looked at how easy it is to start developing Unity games.

Pretty easy, thank the gods! (praise the sun)

So, here goes..

(Make sure your Nvidia drivers are up to date and supported: here )

Firstly download and install the 0.7 sdk from here. Set up your Oculus and verify you have the blue light and can see the demo scene.

Then, install Unity 5+ from here, and download the¬†“Oculus Utilities for Unity 5” from here.

Unzip the utilities and copy the package and project folder into the assets folder in Unity3D.

Start Unity and quickly (or slowly, whatever) create a plane and pop on a couple of cubes.


Now, go to the Asset menu, and import the Oculus Utilities Package.


Once it has finished, drag a OVR Player Controller prefab onto the scene and position it above your plane. Make sure the green outline is above the plane.



Now, build your scene using the File>Build or pressing Ctrl+B.

Note: Previously the Unity integration kit used to build two files and you had to do some jiggery pokery with the monitors. Now, no jiggery pokery required and it only builds one executable, but your Oculus knows when its run.

So, with your headset on, double click your executable and navigate around with your game controller.

Have fun!


Adventures in IOT (Part 1 of n)

Well, I have been going a little IOT crazy for the last few months, and have been Hackathoning in pretty much all my spare time, so I’m going to do a few posts on some basic knowledge I have picked up in IOT, namely using Ardunios and Arduino clones on Windows and mac.

Firstly, IOT on the mac, using Arduino created boards is pretty simple as the mac doesn’t have a USB driver layer that windows has. However, using clones and 3rd party chips like the ESP8266 on the mac has proven to be a little bit of a challenge.

I bought a handful of UNO and leonardo clones from xsource and while they work perfectly fine with the standard sketches using bog standard sensors, everything goes awry when clones are used.

This is because a vast majority of the clones use a WC CH340 chip for comms, which the standard arduino pack doesn’t 100% support. Seems fine in windows however, so go figure. And as I am trying to use my mac a bit more (thanks, web dev community), I started taking it to the hackathons so had to get this issue sorted.

Unfortunately, the drivers from the manufacturer are not signed so Yosemite doesn’t trust them. So, you can either piss about with the linux subsystem or download them from someone on the interweb who has packed them into a trusted package. Thanks dude! However… they cost a small fee (‚ā¨7.47), but its worth it.

Also worth getting is “Serial” which has a ton of drivers cooked in for when you need to dick about with a serial connection. Get it from the app store.

So far, all my clones have worked ok (after driver installing, as above), even though¬†I have been pretty random with my buying just because they mostly come from china and I never know whether they will turn up or not. Generally, the boards have cost around ‚ā¨7 – ‚ā¨10 and have took around two weeks to wing their way across the world. ¬† ESP8266s have cost around ‚ā¨3 – ‚ā¨5 and can be used to make wifi enabled devices. I have hooked these bad boys up to azure, webAPI, heroku (node) and a nice¬†IOT cloud service at¬† which allows you to pipe data directly to a cloud endpoint. You can then create triggers based on the data it receives to¬†get sms alerts, emails, signals sent to other devices and a load of other pretty cool stuff very easy and very quickly.

I’ll be putting some demos up, probably using IOT with azure in the coming days so stay tuned.

Catch you later