Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private key with Windows line endings produce invalid format error #1315

Closed
ghost opened this issue Dec 28, 2018 · 9 comments
Closed

Private key with Windows line endings produce invalid format error #1315

ghost opened this issue Dec 28, 2018 · 9 comments

Comments

@ghost
Copy link

ghost commented Dec 28, 2018

"OpenSSH for Windows" version

OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4

Client OperatingSystem

Windows 10 Home

What is failing

ssh-add

Expected behavior

The key is added to the SSH agent.

Actual behavior

I get the following error message:

Error loading key "C:\Users\myusername/.ssh/id_rsa": invalid format

Workaround

Open the file containing the private key in for example Notepad++, select "Edit" -> "EOL Conversion" -> "Unix (LF)" and save.

Notes

This situation is likely to happen when you have your key checked into version control and your git client automatically converts line endings from Unix to Windows format. This happening to other files like your ~/.ssh/config appear to not cause problems.

@manojampalam
Copy link
Contributor

This is fixed in 7.7.*. Please try the latest version. Reopen if you still see any issues.

@ghost
Copy link
Author

ghost commented Jan 9, 2019

@manojampalam Thanks for the feedback. I installed all the updates on my Windows 10 setup but still have the older version of OpenSSH. Is there any way to get the latest version installed, or do I need to wait for future updates to be pushed to my device?

@manojampalam
Copy link
Contributor

hmm. you should see 7.7 in the latest update (1809)

c:\ ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

@ghost
Copy link
Author

ghost commented Jan 10, 2019

@manojampalam After applying all updates and rebooting I currently have this environment:

PS C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Home
OS Version:                10.0.17134 N/A Build 17134
PS C:\> ssh -V
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4

Do I need to enable anything, like an insider preview or something similar?

@ghost
Copy link
Author

ghost commented Jan 10, 2019

@manojampalam On Windows Server I am getting the new version:

PS C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows Server 2019 Datacenter Evaluation
OS Version:                10.0.17763 N/A Build 17763
PS C:\> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

It would appear that Windows 10 is running behind.

@ghost
Copy link
Author

ghost commented Jan 14, 2019

@manojampalam I just got the October update this morning and am now running on the latest version:

PS C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Home
OS Version:                10.0.17763 N/A Build 17763
PS C:\> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

@ghost
Copy link
Author

ghost commented Jan 14, 2019

After the update I am now running into a completely unrelated issue:

https://github.com/MicrosoftDocs/windowsserverdocs/issues/2235

I am therefore unfortunately unable to test this.

@manojampalam
Copy link
Contributor

manojampalam commented Jan 14, 2019

I've raised an issue to have the docs updated.
ssh-agent installed in-box in Windows 10 is by-default disabled. You'll need to run the following as admin to enable it
Set-Service ssh-agent -StartupType Manual

@ghost
Copy link
Author

ghost commented Jan 16, 2019

@manojampalam Thanks, that fixed the problem for me and am now able to test this. I can confirm this is working fine now on my environment with Windows line endings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant