SSH could not create directory /home/USERNAME/.ssh

cygwin;pythonrdiff-backupscriptssh

My script is executing the below command:

command = os.system('rdiff-backup --exclude "**.dropbox**" --exclude "**.ini**" --remote-schema "ssh -o UserKnownHostsFile=/cygdrive/c/Users/Adam/.ssh/known_hosts -i /cygdrive/c/Users/Adam/.ssh/id_rsa %s -p1019 rdiff-backup --server" C:/Users/Adam/Dropbox pi@192.168.0.5::/mnt/disk1/Adam/Dropbox')

As you can see, I have told it where to look for the known_hosts folder and told it where the key was – without these two questions I would be constantly asked about adding my server to known_hosts each and every execute and be required to enter the password, for each and every execute. It's a shame SSH couldn't locate these independently, my assumption is that it always worked from the same directory, C:\Users\Adam\.ssh?

Anywho, the only error message I get now is Could not create directory '/home/Adam/.ssh' – I've ensured my HOME variable for my current User is correct but it still can't seem to find the .ssh folder. The script executes no problem, it's just this annoying error message. I'm using the SSH package from Cygwin, I'm not sure how important this is? Also, I generated the .ssh directory using Rsync's ssh.exe file, not Cygwin's. Is this important?

Best Answer

I found the answer to my solutions in this blog post.

"First locate the file called passwd in your C:\path\to\cygwin\etc directory and open it with wordpad. Second, replace the text /home/YOUR_NAME with /cygdrive/c/Documents and Settings/YOUR_NAME Finally, save the file."


Update

Some people have reported that adding %USERPROFILE% as a value to a system variable called "HOME" works.

Related Question