28

I'm Rsync-ing with the following command:

# rsync -arvce ssh /tmp/rsync/file.txt user@domain:/tmp/rsync/

This works fine, and I will have to do this for multiple places, so I want to implement the StrictHostKeyChecking option.

After reading other online examples I've added the option like this (3 examples):

# rsync -arvce ssh -o 'StrictHostKeychecking no' /tmp/rsync/file.txt user@domain:/tmp/rsync/

# rsync -arvce ssh -o 'StrictHostKeychecking=no' /tmp/rsync/file.txt user@domain:/tmp/rsync/

# rsync -arvce ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/rsync/file.txt user@domain:/tmp/rsync/

I still get prompted to validate the target server's key. I understand the -o StrictHostKeychecking=no options let me choose whether to bypass that step each time I open a connection.

Am I doing it incorrectly?

here' some links I've read about this:

http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html

http://www.thegeekstuff.com/2010/04/how-to-fix-offending-key-in-sshknown_hosts-file/

http://www.cyberciti.biz/faq/linux-appleosx-howto-disable-ssh-host-key-checking/

jww
  • 97,681
  • 90
  • 411
  • 885
coffeemonitor
  • 12,780
  • 34
  • 99
  • 149

1 Answers1

69

I've resolved it.

Here's the correct (or mostly correct) way to add that option:

# rsync -e "ssh -o StrictHostKeyChecking=no" -arvc /tmp/rsync/file.txt user@domain:/tmp/rsync/

Appears there's a finicky way to apply the option, by adding double quotes and placing the ssh inside.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
coffeemonitor
  • 12,780
  • 34
  • 99
  • 149
  • 11
    Specifically, the -e option is required. From manpage, "-e [specifies] the remote shell to use" – kxsong Sep 11 '14 at 17:55
  • Thank you, this is what I was looking for specifically. – Huckphin Jan 05 '18 at 01:41
  • Also should you be tempted to inline the code somewhere, make sure you really use `"` around the `ssh...` and not just `'` as this might not be recognized by rsync. – stiller_leser May 09 '18 at 09:18