Windows XP autossh
Windows XP and Autossh
First off, one needs cygwin. Download from here:
Select setup and be sure to select Autossh from the Net list.
All required dependencies will be automatically installed as well.
Follow this howto and adjust line from there to have the extra triggers from above if you want to skip those steps. http://www.matthanger.net/2008/04/creating-persistent-ssh-tunnels-in.html
I've copied and listed the above here below for easier reference - all credit goes to Matt
Matts ten things to do
Creating persistent SSH tunnels in Windows using autossh
- Download Cygwin ( http://www.cygwin.com/ )
- Install Cygwin, selecting the autossh package.
- Start the Cygwin shell (Start -> Programs -> Cygwin).
- Generate a public/private key pair.
- At the command line, run:
- Accept the default file locations
- Use an empty passphrase
- Copy your newly-created public key to the SSH server.
scp .ssh/id_rsa.pub email@example.com:id_rsa.pub
- Add your public key to your list of authorized keys on the server.
- Login to your SSH server.
cat id_rsa.pub >> .ssh/authorized_keys
- Test your key.
- Logout of your SSH sever.
- Login to your SSH server again. This time, your key will be used for authentication and you won't be challenged for your login credentials. If you are not logged in automatically, review the previous steps. Or contact your server administrator.
- Logout of your SSH server.
- Exit of the Cygwin shell.
- Install autossh as a Windows service.
- Now back in Windows, open a new command Window (Start -> Run -> cmd).
cygrunsrv -I AutoSSH -p /usr/bin/autossh -a "-M 20000 -L localaddress:port:serveraddress:port firstname.lastname@example.org" -e AUTOSSH_NTSERVICE=yes
- I had to alter the above slightly to get it to work on my end; just putting my version here as well (passing rdp to internal port 51353)
cygrunsrv -I AutoSSH -f "Autossh tunnel" -t auto -y tcpip -O -u $USER -w $PASS -p /usr/bin/autossh -a "-M 20507 -R 51353:127.0.0.1:3389 $USER@$SERVER -p 15266 -g2CN" -e AUTOSSH_NTSERVICE=yes
- Tweak Windows service settings.
- Open the Services management console (Administrative Tools -> Services).
- Edit the properties of the AutoSSH service.
- In the "Log On" tab, select the "This account" radio button and set the service to run as your current user.
- Start the service.
- Test your tunnels.
Get status from windows server
cygrunsrv --query AutoSSH
Remove windows service
cygrunsrv --remove AutoSSH