Я пытаюсь скопировать файлы (scp) с одного удаленного сервера на другой удаленный сервер. Удаленные серверы работают под управлением Ubuntu и используют аутентификацию SSH. Серверы синхронизируются с LDAP, и все открытые ключи пользователей хранятся на сервере LDAP.
Я использую Mac с OSX Mavericks - я выполнил эти инструкции, чтобы настроить переадресацию агента на моем Mac: https://developer.github.com/guides/using-ssh-agent-forwarding/
Когда я пытаюсь запустить команду:
luca-macbook:~ luca$ scp users@remoteserver:/home/ubuntu/file users@remoteserver:/home/ubuntu/
Я получаю следующую ошибку:
Host key verification failed.
lost connection
Может кто подскажет, что я делаю не так?
Во-вторых, если я хочу скопировать весь каталог, могу ли я просто ввести то же, что и выше, и он переместит все файлы в каталоге в или мне нужно где-то иметь -R?
Заранее спасибо.
Эта ошибка означает, что ключ удаленного хоста изменился или вы используете StrictHostKeyChecking
:
StrictHostKeyChecking If this flag is set to “yes”, ssh(1) will never automatically add host keys to the ~/.ssh/known_hosts file, and refuses to connect to hosts whose host key has changed. This provides maximum protection against trojan horse attacks, though it can be annoying when the /etc/ssh /ssh_known_hosts file is poorly maintained or when connections to new hosts are frequently made. This option forces the user to manually add all new hosts. If this flag is set to “no”, ssh will automatically add new host keys to the user known hosts files. If this flag is set to “ask”, new host keys will be added to the user known host files only after the user has confirmed that is what they really want to do, and ssh will refuse to connect to hosts whose host key has changed. The host keys of known hosts will be verified automatically in all cases. The argument must be “yes”, “no”, or “ask”. The default is “ask”.
Очистите его, используя:
$ ssh-keygen -R $remoteserver
и попробуй еще раз. На этот раз вас попросят подтвердить личность удаленного сервера по его отпечатку ключа.
Для переноса целых каталогов -r
используется:
-r Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.
Все это задокументировано в scp(1)
, ssh-keygen(1)
и ssh_config(5)
manpages.