8
votes

I want to set up an SSH tunnel to run as a Windows service, I need to be able to set it up using only the command line so this counts out any software that doesn't include a command line version.

What tools are available for Windows that I could use to do this?

closed as off-topic by Michael Hampton Mar 12 '18 at 21:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

locked by Michael Hampton Mar 12 '18 at 21:40

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. See the help center for guidance on writing a good question.

Read more about locked posts here.

4
votes

If your Windows system is running an SSH server, you can establish a reverse tunnel starting the connection from the other side.

There are several SSH servers available for Windows, for example copssh. On the other side you could use autossh for making sure that the tunnel gets re-established in case that the connection between client and server is lost.

In this way, instead of having to run an ssh client as a service on Windows, you'd need to run an ssh server like the one I mentioned.

  • That's an interesting idea, i'll look into this. Thanks – Callum Aug 19 '09 at 2:08
  • @mfriedman: Would you still recommend copssh today? Their website says the free version is outdated. – einpoklum Oct 22 '13 at 16:11
4
votes

Bitvise WinSSHD

I've used WinSSHD from Bitvise and had really good luck with it in the past.

Once of the nice things I like about it is when you have a server out of control and can't get into it via VNC because its pegged at 100% CPU or out of memory and thrashing the virtual memory you can always get in with SSH to issue a reboot command.

http://www.bitvise.com/download-area

I haven't installed it (fresh) in a while so I'm trying to remember if it supports straight command line or not. You'd have to take a look.

  • We have several servers that maintain SSH connections as a windows service. I use NSSM to configure the windows service. It works great. – Ronnie Overby Jun 29 '15 at 19:55
2
votes

You could try PuTTY Tray

http://haanstra.eu/putty/

Not a windows service, but close enough. You can have it start a saved profile from the command line with

puttytray.exe -load "<profile name>"

If you login automatically with key-authentication, you can easily configure it to reconnect on disconnect and be visible only as tray icon.

  • So, what does one need to do other than add this line to the list of 'Run' commands on login? Where do you configure it to reconnect-on-disconnect and start up minimized-to-tray? – einpoklum Jun 18 '15 at 7:42
  • It's just a fork of the regular PuTTY with extra options available. e.g The Window|Behavior tab has an extra panel for "Adjust the icon" where you can set "Show tray icon: On start". The Connection tab has "Attempt to reconnect on connection failure" etc. – rwired Jun 18 '15 at 12:24
2
votes

I have been using FreeSSHD for some time with much success. It can run as a service, supports certificate login, and full tunneling...

2
votes

I use cygwin's openssh package to do this with great success.

The openssh package includes an SSH server, sshd, that can easily be installed as a Windows service using the script ssh-host-config and then simply starting it using the Windows command net start sshd. Complete details are omitted simply for the sake of brevity...

Gina Trapani posted step-by-step instructions on Lifehacker now a few years old but, as far as I can tell from a quick scan, remain 100% applicable and accurate.

  • 1
    How are you using sshd to have a tunnel up constantly? The page you linked to does not mention tunnels. – einpoklum Jun 18 '15 at 18:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.