Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host Key Verification Failed with sshpass rsync

Tags:

ssh

rsync

sshpass

On my linux server I run the command:

sshpass -p 'password' rsync -avz /source/folder/ [email protected]:/dest/folder

When I run the command without sshpass it will provide me with prompts for authenticity of host and the password.

I need some equivalent to "-o StrictHostKeyChecking=no" (which I use for ssh) that will allow me to run this with no prompts or errors.

Everything I saw from googling was about ssh throwing the error not rsync.

like image 959
khm Avatar asked Jun 02 '17 21:06

khm


People also ask

What is host key verification?

The host key is used by the client to decrypt an authentication message sent from the server when connecting. The basic purpose of the host key is to ensure that when you connect to a remote host, it is actually the host that you intended to connect to.

How does ssh Keyscan work?

ssh-keyscan uses non-blocking socket I/O to contact as many hosts as possible in parallel, so it is very efficient. For successful host key collection, you do not need login access to the machines that are being scanned, nor does the scanning process involve any encryption.


1 Answers

If you want to connect to new server, which public key is not yet in your ~/.ssh/knonwn_hosts, you should not skip this only security check, but rather store the server host key in the known_hosts manually, verify that it is correct and then make the automatic check working.

Simplest way to get the known hosts populated with the server host key is using

ssh-keyscan server-ip >> ~/.ssh/known_hosts

After that, you should not need to use the StrictHostKeyChecking=no workaround.

like image 155
Jakuje Avatar answered Nov 24 '22 04:11

Jakuje