Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
Thanks. I face problems using the srvany in dynamic IP environment and it is not practical to go ahead with the Putty as service solution. I finally decide to use plink to perform the ssh connection. –  Chau Chee Yang Mar 14 '12 at 4:22
    
Could you please expand about the solution? I am using plink for the same, but I still get service not responding to control request. I receive some net helpmsg 2186 that is not very helpful. –  Sopalajo de Arrierez Jul 13 at 13:56
1  
@SopalajodeArrierez: Are you using plink through srvany or directly? –  grawity Jul 13 at 19:41
    
@grawity: tested in both ways. I have finally solved it: my plink.exe was attemping to run from a network drive. I have moved to c:\Putty and now it works OK. Thanks you. –  Sopalajo de Arrierez Jul 13 at 20:28
    
@SopalajodeArrierez: Ah, yes, a service would not have access to your network credentials. (Although it could be configured to run under a specific account, rather than the generic one.) –  grawity Jul 14 at 5:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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