# Windows – How to run a putty ssh tunneling as Windows service

puttyservicessshssh-tunnelwindows

In Windows XP or above, I may run a shell command

putty.exe -load ssh_tunnel


to start a ssh session configured as ssh tunneling.

I want to ssh tunnel session become available when my computer start without logon to any user session.

Keep the shell command in Windows service seems to be the only solution. I try create a service:

c:\> sc create ssh_tunnel binpath="c:\putty.exe -load ssh_tunnel
[SC] CreateService SUCCESS


The service created successfully. When I start the service:

C:\>sc start ssh_tunnel
[SC] StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.


It doesn't start.

• Windows services must be specially written to respond to the Service Manager's control requests. You cannot use any random executable as binPath; you'll have to use srvany or similar tools.
You should also use the command-line plink instead of putty, since the latter might not work properly as a service.
Finally, note that PuTTY sessions are per-user, stored in your Windows profile. Services normally run under special accounts, using the SYSTEM profile. You'll have to change the service to run under your own account, or configure the session in the SYSTEM profile as well (psexec -dsi putty).