Issues using scp to copy a file in Unix

2

I have a script where i need to get the cksum of the files in a directory from another host. I was able to do ssh to another host and create the file.txt. what i need to do now is to scp the file back to the host where i executed the script.

find $2 \! -type p -exec cksum {} \; >> file.txt; scp /home/file.txt username@hostname:/home/user

here are the output of the command above:

Host key verification failed.
lost connection

I can't scp file.txt back to the host where i executed the script.

wow123

Posted 2014-11-15T06:25:11.643

Reputation: 23

Answers

1

Host key verification failed.

That usually means that your local SSH config has no idea who the host is and needs to have that host added to the list of known hosts in the RSA SSH list. The easiest way to fix it is to just SSH in manually like this:

ssh username@hostname

You will get a message like this; all addresses used here are examples only of course:

The authenticity of host 'hostname (123.456.789.0)' can't be established.
RSA key fingerprint is aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:mm:nn:00:11.
Are you sure you want to continue connecting (yes/no)?

Just type in yes and then you will get this message followed by a password prompt:

Warning: Permanently added 'hostname,123.456.789.0' (RSA) to the list of known hosts.

And now the host hostname is added to the list of known hosts on your RSA chain. So now when you run the scp command all should work as expected. This is strictly a one-time action that you need to do on any host you plan on connecting to hostname. After that, the “Host key verification failed.” error will not come up again.

JakeGould

Posted 2014-11-15T06:25:11.643

Reputation: 38 217