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

Cmder unable to find .ssh folder #387

Closed
willemdh opened this issue Feb 8, 2015 · 19 comments
Closed

Cmder unable to find .ssh folder #387

willemdh opened this issue Feb 8, 2015 · 19 comments

Comments

@willemdh
Copy link

willemdh commented Feb 8, 2015

Hello,

I installed Cmder with Chocolately on Windows 8.1. It seems by default it installs under C:\Tools

Then I installed boot2docker for Windows.

When I ssh to the boot2docket vm from boot2docker start, it does not ask for any password, as the public / private keys are in C:\Users\Willem.ssh
I would have expected Cmder also look in C:\Users\Willem.ssh for keys, but apparently it does not. When I explicitly define the location of the boot2docker private key like this it does work:
ssh -v2 -i C:\Users\Willem.ssh\id_boot2docker [email protected]

So is there a way to make Cmder look at C:\Users\Willem.ssh for keys? Where does it look by default? I tried moving the .ssh folder to C:, to C:\tools\cmder\config

Please advise how to make Cmder look at the correct .ssh folder.

Tried adding environment variable 'HOME' with value '%USERPROFILE%' but it didn't not help.

Thanks and grtz

Willem

@MartiUK
Copy link
Member

MartiUK commented Feb 8, 2015

I do not maintain the chocolatey version of cmder, my only suggestion is to try an official release here on GitHub and try using that.

@willemdh
Copy link
Author

willemdh commented Feb 9, 2015

Thanks MartiUK. I will try your suggestion. Can you just tell me where Cmder will look by default for ssh keys?

@MartiUK
Copy link
Member

MartiUK commented Feb 9, 2015

By default msysgit uses %HOME%\.ssh
So In your case that would be C:\Users\Willem\.ssh

@willemdh
Copy link
Author

willemdh commented Feb 9, 2015

I downloaded the latest version of Cmder from Github and put it in my Dropbox account this time/

C:\Users\Willem.ssh exists and has the correct keys in for the boot2docker vm as when I use the boot2docker start.sh script, I do not have to give any password.

When I use Cmder to ssh to boot2docker
ssh [email protected]

It keeps asking me for my password hence I still think Cmder / msysgit does not find %HOME%.ssh

Tried adding HOME environment variable to Windows, but it does not seem to help.

windows_env

Also tried with HOME=C:\Users\Willem\

Still does not work.

Any help to make this work is highly appreciated. I'm not sure how I could find out where things are going wrong.

@willemdh willemdh changed the title Cmder unable to fins .ssh in %USERPROFILE% Cmder unable to finds .ssh folder Feb 9, 2015
@willemdh willemdh changed the title Cmder unable to finds .ssh folder Cmder unable to find .ssh folder Feb 9, 2015
@MartiUK
Copy link
Member

MartiUK commented Feb 9, 2015

Just to clarify, the folder you have your keys in is C:\Users\Willem.ssh not C:\Users\Willem\.ssh?

@willemdh
Copy link
Author

willemdh commented Feb 9, 2015

Hey MartiUk,

The folder where my ssh keys are located is C:\Users\Willem.ssh

.ssh is a folder, see this screenshot:

windows_ssh

@Andi-Lo
Copy link

Andi-Lo commented Feb 10, 2015

Have the same pathing and got the exact same problem

@Fumler
Copy link

Fumler commented Mar 31, 2015

Same problem here.

@MartiUK
Copy link
Member

MartiUK commented Mar 31, 2015

If you run ssh -v [email protected] where is it looking for the identity files? Mine for example says debug1: identity file /c/Users/Martin/.ssh/id_rsa type 1

@Fumler
Copy link

Fumler commented Mar 31, 2015

Aha, that fixed it for me, I was using the one github for windows created, which was named github_rsa, just renamed it id_rsa 👍 Thanks.

@willemdh
Copy link
Author

willemdh commented Apr 1, 2015

λ ssh -v [email protected]
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Willem/.ssh/identity type -1
debug1: identity file /c/Users/Willem/.ssh/id_rsa type -1
debug1: identity file /c/Users/Willem/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-sha1 none
debug1: kex: client->server aes128-cbc hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: /c/Users/Willem/.ssh/identity
debug1: Trying private key: /c/Users/Willem/.ssh/id_rsa
debug1: Trying private key: /c/Users/Willem/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

I hope this helps to identify the issue? When I connect to my boot2docker vm, it still asks for the password. ssh keys are in C:\Users\Willem.ssh

@willemdh
Copy link
Author

willemdh commented Apr 1, 2015

MartiUK, I got it working! It was some time ago I did this, so I though I'd generate new keys and try again. After doing the following when in the user folder:

ssh-keygen -t rsa

ssh-copy-id [email protected]

cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

I can connect from Cmder to Boot3Docker without password. Thanks for the help and the patience!

@willemdh willemdh closed this as completed Apr 1, 2015
@MartiUK
Copy link
Member

MartiUK commented Apr 1, 2015

@willemdh If you're trying to ssh to your boot2docker you need to specify the id file you want ssh to use i.e. ssh -i c:\Users\Willem\.ssh\id_boot2docker username@hostname

to make ssh use it all the time add this into your .ssh/config file

Host hostname
  IdentityFile C:\Users\Willem\.ssh\id_boot2docker

@MartiUK
Copy link
Member

MartiUK commented Apr 1, 2015

@willemdh Ah, that's another way of doing it.

@willemdh
Copy link
Author

willemdh commented Apr 1, 2015

Thanks Marti! And good job on the Cmder. I'm using it alot. THe only other issue I still have is this #379
Any ideas? :)

@Ciwan1859
Copy link

Ciwan1859 commented Aug 17, 2017

@MartiUK I'm having the same issue but with BitBucket. In Git Bash, I only have to input my password once, then I can git pull and git push as many times as I want without the need of a password. But on Cmder, each time I do a remote git command, it asks for the bitbucket password!

My .ssh folder sits here C:\Users\jkhalaf\.ssh and in the config file I have:

Host bitbucket.org
 IdentityFile C:\Users\jkhalaf\.ssh\id_rsa

Any ideas?

@MartiUK
Copy link
Member

MartiUK commented Aug 17, 2017

@Ciwan1859 Have you added the key to the ssh-agent?

@Ciwan1859
Copy link

@MartiUK, yep I have. I tried to do it again in Cmder, but I got the following:

Cmder ssh-add

But in Git Bash, it was added fine!

GitBash ssh-add

Afterwards, I restarted Cmder, but again it asks for the password on each remote git command.

@rmsraph
Copy link

rmsraph commented Dec 1, 2020

try this: C:\\Users\\Willem\.ssh\\id_rsa

double back slash

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

6 participants