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

SshServiceWindows 10Openssh

Ssh Problem Overview


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?

Ssh Solutions


Solution 1 - Ssh

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

Solution 2 - Ssh

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.

Solution 3 - Ssh

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

Solution 4 - Ssh

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

Solution 5 - Ssh

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionquervernetztView Question on Stackoverflow
Solution 1 - SshDonalView Answer on Stackoverflow
Solution 2 - SshquervernetztView Answer on Stackoverflow
Solution 3 - SshbetontalpfaView Answer on Stackoverflow
Solution 4 - SshmmerleView Answer on Stackoverflow
Solution 5 - SshDon KartacsView Answer on Stackoverflow