Starting ssh-agent on Windows 10 fails: "unable to start ssh-agent service, error :1058"
Asked Answered
B

7

471

When I try to start the ssh-agent on Windows 10 via PowerShell (with elevated right or without) by entering Start-Service ssh-agent I get the error

unable to start ssh-agent service, error :1058

When I check of the service is running via Get-Service ssh-agent is returns that the service is stopped.

How can I get the ssh-agent running?

Baumgartner answered 31/8, 2018 at 10:44 Comment(0)
B
218

I solved the problem by changing the StartupType of the ssh-agent to Manual via Set-Service ssh-agent -StartupType Manual.

Then I was able to start the service via Start-Service ssh-agent or just ssh-agent.exe.

Baumgartner answered 31/8, 2018 at 10:44 Comment(4)
I get the error Set-Service is not recognized as an internal or external command. What should I do in that caseFlaviaflavian
By default the service is disabled in Windows 10. You need to set its startup type to manual as it work start while it's disabled.Shank
@Flaviaflavian Use PowerShell instead of CMDProgressive
Please make sure to run the command with Administrator accessBorderer
T
750

Yeah, as others have suggested, this error seems to mean that ssh-agent is installed but its service (on windows) hasn't been started.

You can check this by running in Windows PowerShell:

> Get-Service ssh-agent

And then check the output of status is not running.

Status   Name               DisplayName
------   ----               -----------
Stopped  ssh-agent          OpenSSH Authentication Agent

Then check that the service has been disabled by running

> Get-Service ssh-agent | Select StartType

StartType
---------
Disabled

I suggest setting the service to start manually. This means that as soon as you run ssh-agent, it'll start the service. You can do this through the Services GUI or you can run the command in admin mode:

 > Get-Service -Name ssh-agent | Set-Service -StartupType Manual

Alternatively, you can set it through the GUI if you prefer.

services.msc showing the properties of the OpenSSH Agent

Tommi answered 4/12, 2018 at 6:15 Comment(10)
I was receiving the error Set-Service: Service 'OpenSSH Authentication Agent (ssh-agent)' cannot be configured due to the following error: Access is denied.. There were no problems doing it via the GUI though.Sharilyn
I assume that means you weren't using an admin shellTommi
Yes I wasn't using an admin shell.Sharilyn
After Windows 10 update 2004 this was reset to disabled and had to repeat these instructions.Crosstie
I was getting "Access is denied" when trying to do "-StartType Manual" (probably due to it's a working laptop I don't know) but the GUI does the job. Thanks for sharing the extra tip!Hellebore
for those wondering how to access the GUI, just: bring up the start menu --> type Services --> find the OpenSSH Authentication Agent serviceAenea
It helped me. Did not know what is the problem, but it was because of the StartType disabled. Thanks!Steiermark
'Get-Service' is not recognized as an internal or external command, operable program or batch file. Got this error in powershellIneffaceable
@AhmedNawazKhan what's your powershell version? In powershell, type: $PSVersionTableTommi
This is the answer and should be marked as such.Relinquish
B
218

I solved the problem by changing the StartupType of the ssh-agent to Manual via Set-Service ssh-agent -StartupType Manual.

Then I was able to start the service via Start-Service ssh-agent or just ssh-agent.exe.

Baumgartner answered 31/8, 2018 at 10:44 Comment(4)
I get the error Set-Service is not recognized as an internal or external command. What should I do in that caseFlaviaflavian
By default the service is disabled in Windows 10. You need to set its startup type to manual as it work start while it's disabled.Shank
@Flaviaflavian Use PowerShell instead of CMDProgressive
Please make sure to run the command with Administrator accessBorderer
T
8

To solve this problem follow only a few steps:

1 => open Window Powershell as administrator and write

2 => Get-Service ssh-agent //(you will find status stopped )

3 => Now write in the Powershell

4 => Set-Service ssh-agent -StartupType Manual

you will find status running.. hopefully help to resolve the problem.

Tetrameter answered 13/9, 2022 at 12:1 Comment(0)
M
7

I get the same error in Cygwin. I had to install the openssh package in Cygwin Setup.

(The strange thing was that all ssh-* commands were valid, (bash could execute as program) but the openssh package wasn't installed.)

Makepeace answered 29/11, 2018 at 9:3 Comment(0)
G
6

Adding here that if you have this problem and run start-ssh-agent in PowerShell it will "switch" to cmd(not powershell) like functionality until you exit the batch job started by your previous command. If you don't, you can no longer access PowerShell functions and will get errors like: 'Get-Service' is not recognized as an internal or external command, operable program or batch file

enter image description here

Gaudreau answered 31/5, 2022 at 15:12 Comment(0)
C
4

This just happens to me because I was running the command in a non-administrator Powershell. Running it with admin powers solved the problem

Cocytus answered 7/7, 2021 at 13:18 Comment(0)
O
0

I was unable to get the SSH agent started due to the executable itself being corrupt. The error I was getting was 1053, won't start in a timely manner.

This was in the event viewer log

Faulting application name: ssh-agent.exe, version: 8.6.0.1, time stamp: 0x624f4fc8
Faulting module name: ssh-agent.exe, version: 8.6.0.1, time stamp: 0x624f4fc8
Exception code: 0xc0000006
Fault offset: 0x0000000000020767
Faulting process id: 0x0x478C
Faulting application start time: 0x0x1DA69733420E80B
Faulting application path: C:\Windows\System32\OpenSSH\ssh-agent.exe
Faulting module path: C:\Windows\System32\OpenSSH\ssh-agent.exe
Report Id: e09f95af-119c-4e70-999b-f49fdaaf76cc

Who knows how this happened, but anyway it did.

To fix this, from an elevated powershell prompt:

Organ answered 27/2 at 12:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.