Windows XP autossh: Difference between revisions

From Skytech
Jump to navigation Jump to search
Line 36: Line 36:
4. Generate a public/private key pair.
4. Generate a public/private key pair.
At the command line, run:
At the command line, run:
<pre>ssh-keygen</pre>
ssh-keygen
Accept the default file locations
Accept the default file locations
Use an empty passphrase
Use an empty passphrase

Revision as of 21:26, 12 June 2011


Windows XP and Autossh

First off, one needs cygwin. Download from here:

http://www.cygwin.com/

Select setup and be sure to select Autossh from the Net list.

All required dependencies will be automatically installed as well.

Connection string (cygwin)

cygrunsrv -I AutoSSH -f "Autossh tunnel" -t auto -y tcpip -O -u $USER -w $PASS -p /usr/bin/autossh -a "-M 20007 -R 12003:127.0.0.1:3389 $USER@$SERVER -p 15266 -g2CN" -e AUTOSSH_NTSERVICE=yes


Update

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

1. Download Cygwin ( http://www.cygwin.com/ )

2. Install Cygwin, selecting the autossh package.

3. Start the Cygwin shell (Start -> Programs -> Cygwin).

4. Generate a public/private key pair.

  At the command line, run: 
  ssh-keygen
  Accept the default file locations
  Use an empty passphrase

5. Copy your newly-created public key to the SSH server.

scp .ssh/id_rsa.pub user@ssh.host.name:id_rsa.pub

6. Add your public key to your list of authorized keys on the server.

  Login to your SSH server.
mkdir .ssh
cat id_rsa.pub >> .ssh/authorized_keys

7. 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.

8. Install autossh as a Windows service.

  Now back in Windows, open a new command Window (Start -> Run -> cmd).
cd C:\cygwin\bin
cygrunsrv -I AutoSSH -p /usr/bin/autossh -a "-M 20000 -L localaddress:port:serveraddress:port user@ssh.host.name" -e AUTOSSH_NTSERVICE=yes

9. 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.

10. Test your tunnels.