513

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?

10 Answers 10

833

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

Sign up to request clarification or add additional context in comments.

11 Comments

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.
I assume that means you weren't using an admin shell
Yes I wasn't using an admin shell.
After Windows 10 update 2004 this was reset to disabled and had to repeat these instructions.
for those wondering how to access the GUI, just: bring up the start menu --> type Services --> find the OpenSSH Authentication Agent service
|
241

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.

4 Comments

I get the error Set-Service is not recognized as an internal or external command. What should I do in that case
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.
@Code_Ninja Use PowerShell instead of CMD
Please make sure to run the command with Administrator access
11

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.

Comments

9

Because sometimes the system defaults to the service being disabled.

  1. Press "win + R", enter "services.msc", and open the service control panel.
  2. Find the "OpenSSH Authentication Agent" service in it, set it to "Manual", and everything will work fine.

image description

Comments

8

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

Comments

8

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

Comments

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

Comments

3

You only need to change the StartupType to Manual, and then it will be okay!

Set-Service ssh-agent -StartupType Manual 

more example

# Check default value Get-Service ssh-agent Get-Service ssh-agent | Select StartType # Run Set-Service ssh-agent -StartupType Manual # Test ssh-agent # Stop Stop-Service ssh-agent Set-Service ssh-agent -StartupType Disabled # Test ssh-agent 

Comments

1

I was facing the same error while adding keys to ssh agent. This is how I got it fixed. I have already generated a new SSH key. Next step is to add ssh key to ssh agent. Open git bash and use this command:

eval $(ssh-agent) 

It will show something like this

Agent pid 

then simply add path to ssh key

ssh-add path/to/key 

for example: ssh-add /c/Users/hp/.ssh/id_ed25519

it may ask for passphrase.

Comments

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:

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.