0

I'm using rdiff-backup to send incremental backups to my local server. My host is Windows and my remote is a Linux machine. I'm trying to get my script to execute the following:

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

However, during execution I'm promoted with:

Could not create directory '/home/Adam/.ssh'. The authentictity of host '[192.168.0.5]:1019 ([192.168.0.5]:1019)' can't be established. RSA key fingerprint is 2e:7c:f0:0c:4b:8d:fa:e1:21:a1:32:81:a0:e1:11:11. Are you sure you want to continue connecting (yes/no)?

I thought option -i C:/Users/Adam/.ssh/id_rsa would over-ride this? It is not practical to have this requested per execution of the script. How can I bypass this, whilst maintaining authentication and security (as I will soon write a similar script for my laptop, but to send incremental backups via public and remote machines)?

Update:

Please read grawity's answer, along with the comments, to help yourself understand where I went wrong and how I fixed it - of course with grawity's help. In order to solve the issue with Cygwin saying Cannot create directory /home/USERNAME/.ssh then see 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."

0

What you're seeing...

The authentictity of host '[192.168.0.5]:1019 ([192.168.0.5]:1019)' can't be established.

...is not related in any way to the key you're using user authentication. The message is talking about host authentication – making sure the server is the right one.

Normally the prompt is one-time only, as the server's public key gets stored in ~/.ssh/known_hosts. However, in your case, ssh is unable to create this file because it cannot create the parent directory:

Could not create directory '/home/Adam/.ssh'.

Most likely this fails because /home/Adam itself does not exist, or because /home/Adam/.ssh is something else than a directory. Try creating it manually, using mkdir.

(Also: Reading error messages helps.)

  • The host is Windows. I must mention that I have made successful connection via ssh to my server from Windows before. So why is it asking again? – adampski Mar 31 '14 at 0:47
  • Unimportant. If you are using Cygwin or MinGW builds of OpenSSH, it'll use Unix-like paths, $HOME/.ssh in this case. – user1686 Mar 31 '14 at 0:50
  • Well then I don't understand because C:\Users\Adam\.ssh is existent. Please see my revised comment above yours. – adampski Mar 31 '14 at 0:50
  • Maybe it is using a different path for /home than c:\Users? Try "Process Monitor" from SysInternals to find out where ssh looks... – user1686 Mar 31 '14 at 0:52
  • OK I've used -o UserKnownHostsFile=/path/to/other/known_hosts instead but (always a but) I'm still informed that `Could not create directory '/home/Adam/.ssh'. However, my computer now remembers the server, no longer asks the question. What's this "Could not create directory" business? Surely the $HOME EV is incorrect? – adampski Mar 31 '14 at 1:17
0

You need to check your ~/.ssh/known_hosts for the entry of 192.168.0.5, which might have changed.

This is part of the client-side security mechanism of ssh. Please refer to the ssh documentation and man-page for more information. There is no shortcut to understanding security by posting questions on superuser.com and co.

However, if your question was how to overwrite and deliberatly ignore that, add this parameter to your commandline:

ssh -o StrictHostKeyChecking=no <...>

(And please don't blame me for the consequences of it.)

Have fun.

  • Well actually it was an issue with Cygwin setting an incorrect home directory in its passwd file. – adampski Apr 1 '14 at 20:18
0

I had the same issue. MINGW's SSH is actually home for the path /home//.ssh

Put your SSH configs there and it'll work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.