lukesampson/pshazz

unable to start ssh-agent service, error :1058

Closed this issue ยท 14 comments

After install KB4103721, the error was shown unable to start ssh-agent service, error :1058.

What is ssh-agent ? What's wrong?

It seems the issue is caused by $profile file encoding. Changing file encoding from UTF16-LE to
Shift-JIS and error is not shown. (My System language is Japanese)
But it has never been happened since I start to use phazz.

I'm hitting exactly the same problem and even a full reinstall of scoop doesn't fix the issue. Any tips on how to get past the warning?

Having the same problem, even if I run ssh-agent manually. I've removed Windows 10 1803's OpenSSH agent (Optional Features on the Start Menu) as a workaround, but it would be nice if this worked without having to do that. Posh-git is having similar issues - see dahlbyk/posh-git#583.

myty commented

I was getting this message and I went into look at the local services and the actual "OpenSSH Authentication Agent" service was disabled. Maybe the 1803 update disabled it, but I'm not sure. I set the service to automatic and now all is fine.

C:\environment>ssh-agent
unable to start ssh-agent service, error :1058

WIth PowerShell I ran install-sshd.ps1

cd .\Program Files\OpenSSH-Win64
PS C:\Program Files\OpenSSH-Win64> .\install-sshd.ps1
[SC] SetServiceObjectSecurity SUCCESS
[SC] ChangeServiceConfig SUCCESS
[SC] ChangeServiceConfig2 SUCCESS
sshd and ssh-agent services successfully installed

that worked for me

I fixed it by Set-Service ssh-agent -StartupType Manual With windows 10 built in SSH

This error occurred after 1809 update. Opening PowerShell as Admin & running Set-Service ssh-agent -StartupType Manual fixed this issue for me.

C:\environment>ssh-agent
unable to start ssh-agent service, error :1058

WIth PowerShell I ran install-sshd.ps1

cd .\Program Files\OpenSSH-Win64
PS C:\Program Files\OpenSSH-Win64> .\install-sshd.ps1
[SC] SetServiceObjectSecurity SUCCESS
[SC] ChangeServiceConfig SUCCESS
[SC] ChangeServiceConfig2 SUCCESS
sshd and ssh-agent services successfully installed

that worked for me

that is what worked for me too. I think that is the best solution anyway as it will allow you to properly run the service instead of just disabling it.

One gotcha: openssh was not even installed on my machine so I just installed it using chocolatey

choco install openssh

and then after "refreshenv" I applied neusbeers fix. worked like a charm. THX!

C:\environment>ssh-agent
unable to start ssh-agent service, error :1058

WIth PowerShell I ran install-sshd.ps1

cd .\Program Files\OpenSSH-Win64
PS C:\Program Files\OpenSSH-Win64> .\install-sshd.ps1
[SC] SetServiceObjectSecurity SUCCESS
[SC] ChangeServiceConfig SUCCESS
[SC] ChangeServiceConfig2 SUCCESS
sshd and ssh-agent services successfully installed

that worked for me

This also worked for me, much appreciated.

With #76 , the ssh plugin can now detect and start the service automatically.

Set-Service ssh-agent -StartupType Manual
Worked for me also.

I confirm, I was having the same issue and set the startup type as manual. I found it on thie blog but that's exactly the recommandation of most of you.

Set-Service ssh-agent -StartupType Manual
This worked for me,thanks!

assuming you already created the authorized_users file in the users .ssh folder on the server and have these set in your sshd_config file

PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

then do this to finish up, while on the server:

  • Go to the Type Here to Search Box and type Services

  • go to Services

  • double click OpenSSH Authentication Agent

  • set the startup type to Automatic

  • click Start

  • Click Ok and Exit

  • still in the server open Windows Explorer go to your c:/users//.ssh directory

  • right click on authorized_users and click properties

  • go to security > advanced

  • click disable inheritence and convert permissions

  • remove all users except system and yourself

  • click ok and exit out

  • now go back to services and restart the OpenSSH Authentication Agent

you should now be able to ssh into the server using your public key