Bypass Rsync Prompt "Are You Sure You Want to Continue Connecting"

How to automatically accept the remote key when rsyncing?

If they genuinely are new hosts, and you can't add the keys to known_hosts beforehand (see York.Sar's answer), then you can use this option:

-e "ssh -o StrictHostKeyChecking=no"

Host Key Verification Failed with sshpass rsync

I found the following command at cyberciti. This allowed me to do exactly what I needed.

$ rsync --rsh="sshpass -p myPassword ssh -o StrictHostKeyChecking=no -l username" server.example.com:/var/www/html/ /backup/

rcp Vs rsync prompting for password

rcp is an ancient and insecure program for copying files between remote machines. Avoid it. scp (of the ssh suite) is the secure, modern alternative.

rsync is a relatively recent program. When connecting remotely, it uses ssh in the background which, being secure, is what is asking for credentials.

How to pass password automatically for rsync SSH command?

You should use a keyfile without passphrase for scripted ssh logins. This is obviously a security risk, take care that the keyfile itself is adequately secured.

Instructions for setting up passwordless ssh access

Rsync with sshpass on Linux using systemd: 'Host key verification failed.'

The rude way is to add -o "StrictHostKeyChecking=no" to your SSH command:

sshpass -p 'password' rsync -avz -e 'ssh -o "StrictHostKeyChecking=no" -p 22' \home\pi host@IP::home/example

How to supply keys when calling a bash in ruby

run_this = `ssh -oStrictHostKeyChecking=no user@thecomputer cat myfile.txt`

Without the StrictHostKeyChecking option turned off, ssh typically defaults to not trusting any new hosts and will interactively prompt the user if there is one, otherwise it will fail.

The problem you are having is very common. For example, here's someone who was trying to get around this ssh behavior with rsync:

Bypass Rsync Prompt "Are you sure you want to continue connecting"

rsync skip non existing files on source

Use --ignore-missing-args:

The version 3.1.0 man page says,

--ignore-missing-args

 When rsync is first processing the explicitly requested
source files (e.g. command-line arguments or --files-from
entries), it is normally an error if the file cannot be
found. This option suppresses that error, and does not
try to transfer the file. This does not affect subsequent
vanished-file errors if a file was initially found to be
present and later is no longer there.

For example:

% rsync --version
rsync version 3.1.0 protocol version 31
% rsync bogusfile dest
rsync: link_stat "/tmp/bogusfile" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]
% rsync --ignore-missing-args bogusfile dest
# <no error>

The --ignore-missing-args option was added some time between version 3.06 and 3.1.0.

The online version 3.06 rsync man page does not mention it. But the git repository indicates this option was added in 2009.



Related Topics



Leave a reply



Submit