cygWin connect by SSH using RSA key; ssh.exe couldn't create /home/user/.ssh

Solution 1:

Try changing the permissions on .ssh to 700. This is because .ssh is a sensitive directory where private keys are stored.

Another thing to try would be ln -s /cygdrive/c/Documents\ and\ Settings /home, thus causing searches in /home to be redirected to Documents and Settings.

Solution 2:

Oh man... The hours I've burned on this, too...

For me, the solution was: Set a Windows User environment variable named HOME that points to the %USERPROFILE%

Apparently (black box view) this allows the cygwin $HOME environment variable to resolve cleanly to the %USERPROFILE% windows variable and everything comes out in the wash. This will preserve all Windows security for the user profile, too, which makes it the best solution I've seen (... and I've seen a few of them lately!)

Suggestion found at: http://hrivera99.blogspot.com.au/2013/09/openssh-failed-to-add-hosts-to-list-of.html

Hope this saves other people a few hours out of their lives!

Solution 3:

In your Documents and Settings folder of your local machine, create the folder home\<user>. For some reason, cwRsync won't create these folders for you. I didn't change my cygpath, so I created mine in C:\Program Files\cwRsync\home\<user>.

Solution 4:

I solved the problem on my Win7 laptop by creating a directory junction. Open a command tool with admin privileges and run the command:

mklink /j "C:\Program Files (x86)\cwRsync\home" "c:\Users"

Reason :

ssh expects a /home/user_name/.ssh cygwin directory which is the Windows directory C:\Program Files (x86)\cwRsync\home\user_name.ssh given by

cygpath -w /home/user_name/.ssh

A Windows users expects his home directory under the Users directory: C:\Users\user_name A link from C:\Program Files (x86)\cwRsync\home to C:\Users makes the trick.

Note: This may also work with a symbolic link : mklink /d but i did not test it.