Проблемы с использованием scp для копирования файла в Unix

1276
wow123

У меня есть скрипт, где мне нужно получить cksumфайлы в каталоге с другого хоста. Я был в состоянии сделать sshс другим хостом и создать file.txt. то, что мне нужно сделать сейчас, это скопировать файл обратно на хост, где я выполнил скрипт.

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

Вот вывод команды выше:

Host key verification failed. lost connection 

Я не могу scp file.txtвернуться к хосту, где я выполнил скрипт.

1

1 ответ на вопрос

1
JakeGould

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.