Host content on Android with reverse SSH port forwarding in Serverauditor

EDIT: JuiceSSH has fixed the keyboard issue on Samsung devices running Android 5+!

I’m back to using JuiceSSH since their app is more reliable to me (creating port forwards often failed in ServerAuditor and I could never figure out why, but they always work in JuiceSSH). I’m leaving this post here in case anyone wants to use ServerAuditor and needs these instructions.

ORIGINAL POST:

When it comes to SSH clients on Android devices, I was a fan of JuiceSSH until I began using the Note 5 and started having issues with the keyboard.

The short version is that JuiceSSH has a popup keyboard with ctrl/tab/arrows etc. that shows up when you tap the screen. I like it. But on the Note 5, that popup keyboard often/randomly shows up underneath (think photoshop layers) the regular keyboard, which means you can’t see both at the same time, so requires more keypresses to do a ctrl-x for example (hide the main keyboard, hit ctrl, bring up the keyboard, hit x, then hide the keyboard again to see the output which now shows up under the keyboard as well. You can tell the JuiceSSH popup keyboard to appear at the top of the screen, but then the popup keys are very far from the main keyboard, and worse, sometimes the popup keyboard shows up under the status bar (again, think photoshop layers), so you can’t touch the top row of buttons. Also none of this fixes the issue that the terminal drops under the keyboard so you often can’t tell what you’re typing. I’ve emailed JuiceSSH about this; I will update if I get one, as I am still a fan – and paid user of – JuiceSSH). It’s probably a Samsung issue unique to their setup (maybe multi-window?) or maybe relating to screen resolution, but I did try another keyboard and still had the same problem.

So I found Serverauditor in the Play Store. It has many of the same features in the paid (annual subscription) offering, including encrypted credentials/identities, a popup keyboard that works on the Note 5 (and is customizable!), and some great mappings for volume keys and single / double finger swipes. Down-arrowing through a long document in nano is almost a pleasure now with a double-finger down swipe (it’s mapped to PageDn). So I’m happy with it.

But there’s one piece missing from Serverauditor’s UI that JuiceSSH does correctly. I occasionally like to run services like web servers on my phone. Using KSWEB or Bit Server, for example, it’s possible to run a local LAMP (well, lighttpd or nginx at least) stack on your phone for a quick demo. With a reverse SSH tunnel you can offer up a port on an Internet-facing VPS that tunnels to your android device despite whatever NAT your provider is using. Kind of cool, but it requires a little trick to get working in Serverauditor.

First, set up a remote port forward. Enter your VPS host, let’s say from port 81 on the VPS to port 8080 (“port to”) on the Android device. Set Host to at 0.0.0.0 so your phone listens on all interfaces (as I understand it). You will get this screen:

1default remote port forwardAnd it won’t work, because the remote host (your VPS) is only listening on the loopback address 127.0.0.1. You need to set that to 0.0.0.0 (or your choice of public IP on the VPS), but there’s no way to do that in the Remote Port Forward setup screen of Serverauditor:

4switch to remoteSo what to do? See where I’ve circled “Remote”? Click the down-arrow to the right and select “Local”. Now you’ll see that the option to change the remote IP (“Address”) shows up and is set to 127.0.0.1:

2local-wrong-ipChange it to 0.0.0.0 and save using the check icon at the upper right:

3local-change-ipThen go back, edit the port forward again, and set it back to “Remote” instead of “Local” (further testing indicates you may be able to set the Address and set the connection back to “Remote” in the same step):

4switch to remoteYou can’t see the “From” address anymore, but trust me, it’s there and it’s been changed. When you go back to the main port forwards screen, you’ll see this:

5final remote port forwardThe “From” IP is now 0.0.0.0 and your reverse SSH tunnel will work. Anyone who hits port 81 on your VPS will be tunnelled to port 8080 on my phone, which I can set to any directory I want in my favorite Android web server.

Hope this helps – I’ve emailed the folks at Crystalnix about this and hopefully they’ll add a way to change the IP address from the Remote setup screen to bypass this little workaround.