Fun and Profit with Reverse SSH Tunnels and AutoSSH

Sometimes you just need to get to things remotely.  Those things might be behind an unbudging firewall with no way to forward proper ports for remote access, or perhaps you just want it setup access to resources this way.  I recently needed to establish a persistent connection to a new Raspberry Pi setup remotely where the ISP did not allow proper port forwards.  Luckily you can use reverse SSH tunneling and 

Jailkit @debian

How to Create jail

1. Create the binary for debian
apt-get install build-essential autoconf automake libtool flex bison debhelper binutils-gold
tar xvzf jailkit-2.19.tar.gz
cd jailkit-2.19
echo 5 > debian/compat
./debian/rules binary
cd ../
dpkg -i jailkit_2.19-1_amd64.deb


Nodejs and pm2

Install PM2

Now we’ll install PM2, which is a process manager for Node.js applications. PM2 provides an easy way to manage and daemonize applications (run them in the background as a service).

We will use npm, a package manager for Node modules that installs with Node.js, to install PM2 on our server. Use this command to install PM2:

  • sudo npm install -g pm2

The -g option tells npm to install the module globally, so that it's available system-wide.