Scoop: OpenSSH doesn't look in user home for .ssh directory

Created on 26 Apr 2017  路  25Comments  路  Source: lukesampson/scoop

OpenSSH 5.4p1-1 commands look in //.ssh/ for config files, which appears to map to ~\scoop\apps\openssh\5.4p1-1 rather than /c/mnt/{username}//.ssh as described in https://github.com/lukesampson/scoop/wiki/GitHub-with-SSH-Key

If it helps, the ssh included in git-with-openssh works fine. this issue only applies to the standalone openssh package.

Most helpful comment

@tresf @tinchou win32-openssh is now available, but still not production ready! 馃榿

All 25 comments

Can I please get some help here?

Hm, I don't know why this is happening, but I would suggest installing git-with-openssh because the openssh stuff is from 2010. Maybe we should search for a newer OpenSSH standalone (or modify the current git-with-openssh to only install OpenSSH)

Just lurking, but there may be a Microsoft-sponsored binary worth investigating as well. https://github.com/PowerShell/Win32-OpenSSH/releases

If they sort this out: This is a pre-release (non-production ready) 馃槃

I'd see the value in having a win32-openssh package. It's a very small, easy to install zip package distributed through GitHub. Many people included myself would find it is enough for their needs.

I don't remember if I had to set anything up differently, but I believe using scoop's git-with-openssh manifest provides a functional version of OpenSSH without this problem.

@tresf @tinchou win32-openssh is now available, but still not production ready! 馃榿

I have the same issue. I did find a workaround (see below).

ssh-keygen - not using $env:HOMEPATH/.ssh

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open //.ssh/id_rsa failed: No such host or network path.
Saving the key failed: //.ssh/id_rsa.

ssh - not using $env:HOMEPATH/.ssh

PS C:\Users\doug> ssh -v [email protected]
OpenSSH_5.4p1, OpenSSL 1.0.0 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 10.0.1.29 [10.0.1.29] port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_rsa-cert type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: identity file /.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '10.0.1.29' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Workaround

The ssh tools appear to be using $env:HOMEPATH\scoop\apps\openssh\5.4p1-1\.ssh instead of $env:HOMEPATH\.ssh like I expected. If you move your id_rsa into that directory scoop's openssh tools will work.

Still an issue and the work around doesn't work for me.

Thanks for that rundown @drichardson, that worked for me.

This issue appears to have been resolved. If not, please reopen this ticket, or let us know. Thanks!

I'm experiencing similar issues when generating an rsa key (error: saving the key failed).

Here's what I did to get around it. I was creating a new ssh key using ssh-keygen -t rsa -C "[email protected]" and choosing the default option for the "name" (by pressing enter). This would then lead to the error.

I got around this by typing out the name I wanted for the file even if it was the same as the default.

There are reports of openssh 5.4 not working with recent versions of git.

OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases seems to work just fine with my .ssh/config file.

@rasa I tried to install via scoop with scoop install ssh -g and the version provided had issues. It wasn't reading my .ssh/config unless I specified -F .ssh/config and there were some erros regarding my key format. I removed that scoop version and used the version on my link and everything worked fine.

How should one install that version using scoop / your link? Does it have updates? What are the advantages?

You can install via scoop install win32-openssh. Its readme says it's not yet production ready.

There is a built-in Win32 OpenSSH if you're using Windows 10.

There is a built-in Win32 OpenSSH if you're using Windows 10.

@h404bi Yes there is, with no support for password protected keys and some other annoying details.

Have you install pshazz, it has a ssh plugin. ssh use $env:USERPROFILE/.ssh by default if you load that plugin.

@h404bi this is one of the other issues I have with the Windows 10 built in client:

Windows 10 currently (as of January 2018) only supports ed25519 keys
https://stackoverflow.com/questions/47859437/windows-10-openssh-key-invalid-format

Anyway @h404bi and @rasa, I successfully installed the win32-openssh version from Scoop. Does it work with pshazz? I've installed both via sudo scoop install 7zip git win32-openssh pshazz --global however ssh isn't calling pshazz/askpass whenever I'm using a password protected key. Do I need to do any additional setup?

Also... everytime I open powershell I get this:

unable to open service handle
Error connecting to agent: No such file or directory

Also:

$ ssh-add.exe
Error connecting to agent: No such file or directory

Thank you.

Looks like the ssh-agent doesn't launch, Did you activate the pshazz?

$ pshazz use default

After that I still get errors:

unable to open service handle
Error connecting to agent: No such file or directory
Loading personal and system profiles took 669ms.

Trying to SSH an host on my .ssh/config:

~ $ ssh git-server
Excep莽茫o n茫o processada: System.IndexOutOfRangeException: 脥ndice fora dos limites da matriz.
   em askpass.Program.Main(String[] args)
tcb13@git-server: Permission denied (publickey).

Translates as "unprocessed exception: System.IndexOutOfRangeException".

@TCB13 Looks like that your issue is similar to https://github.com/lukesampson/scoop/issues/2268

After having just gone through this on Win10 using the Win10 provided ssh-keygen and ssh, the problem of ssh not loading keys from $env:USERPROFILE/.ssh persists. However, you can simply work around the problem by providing the -i, --identify option to select the private key to use, e.g. ssh -i c:\\Users\\<me>\\.ssh\\id_rsa remotehost. The connection is then made to remotehost from windows cmd.exe using the key (provided you have the corresponding public key in ~/.ssh/authorized_keys on remotehost).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mpro7 picture mpro7  路  3Comments

klauern picture klauern  路  3Comments

notlmn picture notlmn  路  3Comments

SinisterBlade picture SinisterBlade  路  3Comments

benplm picture benplm  路  3Comments