View Single Post
Posts: 433 | Thanked: 274 times | Joined on Jan 2010
#10
Originally Posted by DojwqIO View Post
The ssh reverse tunnel sounds like a nice feature. I just tried it and it works great. But how would you prevent the thief from simply exiting the connection with your home server?!
firstly, the phone is locked, so until the thief reflashes it, he can't get to do anything to the ssh session (and after he's flashed it, it becomes moot anyway!). However, I run the ssh -R command in an infinite loop from within a script that's run automatically whenever the phone's network connection changes (wifi->cellular or vice versa) - so it should restart itself in most circumstances. I am using a similar approach to eitama's excellent wiki http://wiki.maemo.org/Reverse_ssh ... but I found that timing issues with his method (the order in which the interface up & down scripts are called) caused the reestablishment of the ssh session to be very hit & miss; I have done mine slightly differently.

Originally Posted by DojwqIO View Post
Is there a way to keep the ssh connection to the home server open in the background without a terminal screen open?
!
you can pass several parameters to ssh along with -R in order for it not to open a shell (i.e. it doesn't run a command on the remote system, it just goes silently into the background for use as a port forwarder). My full ssh loop is:
Code:
while [ 1 -gt 0 ]; echo "ssh called at " `date` > /var/log/ssh.log ; do ssh -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 -p PPPP -nCNR 19999:localhost:
22 XXXX@YYYY.no-ip.org 2>> /var/log/ssh.log; sleep 60; done
The PPPP is a non-standard port which my router NAT's (port forwards) to openSSH on my PC. The bit that stops a terminal opening is -nN (see ssh man page, there are several valid ways to do this depending on your needs).

Before exposing yourself to the interwebs, I'd strongly advise setting up public key authorisation, disabling password authorisation, and changing your openSSH to listen on a port other than the default :-)
__________________
n900: "with power comes responsibility".

If you buy a niche, highly modifiable smartphone and proceed to mess it up by blindly screwing around, don't just blame the phone, also blame yourelf.

Last edited by Pigro; 2010-09-23 at 16:03.