Termux ssh proxy config snippets
May. 1st, 2018 02:54 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Really I ought to get my vpn up on my phone, but that's work. In the meantime so I can ssh into my phone, I have done this (which is a bit of a bodge, but very easy):
Install termux, and termux:widget. Inside termux, install termux-exec
. (You may need to install the sshd explicitly too.
Arrange for your termux to be able to ssh to your colo with ssh colo
, by putting something like this in your .ssh/config
on the phone:
Host chiark User ijackson Hostname login.chiark.greenend.org.ukPut this script on the phone in
.shortcuts/proxy
and make it executable:
#! /bin/bash sshd ssh -v -R NNNN:localhost:8022 chiark head -1where NNNN was a random port number. On my laptop, where I want to be able to ssh to the phone, add the following to .ssh/config:
Host star-wolf User android ProxyCommand ssh ijackson@chiark nc -q0 localhost NNNNAdd a "widget" to one of the home screen pages to invoke that. (Hold down a finger on an empty bit of the relevant home screen page; select "Widgets"; find Termux in the list, the rest is obvious.)
After copying ssh keys about appropriately, it all works nicely. If you don't have a shell account that you are happy to let your phone have control over, you could probably restrict the key; the syntax for this is left as an exercise to the reader :-).