一、环境
Ubuntu 14.04 + Ubuntu 16.04 + SCP
二、原因
Ubuntu 14.04重装了ssh 服务端,在16.04上能够ssh登录,但不能scp,原因是16.04上的~/.ssh/known_hosts文件内的验证没有更新,出现以下提示:
long@long:~/.ssh$ sudo scp -P 2250 ./桌面/logist.sql
该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。
:/var/www
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Uz6iC5uYv2duVNZUiv6uGnh20MSjTIuT6zqkea/8XSE.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:2
remove with:
ssh-keygen -f "/root/.ssh/known_hosts" -R [218.X.X.202]:2250
ECDSA host key for [218.X.X.202]:2250 has changed and you have requested strict checking.
Host key verification failed.
lost connection
三、解决办法
更新ECDSA即可,命令如下:
long@long:~/.ssh$ sudo ssh-keygen -f "/root/.ssh/known_hosts" -R [218.X.X.202]:2250
# Host [218.X.X.202]:2250 found: line 2
/root/.ssh/known_hosts updated.
四、结果
long@long:~/.ssh$ sudo scp -P 2250 ./桌面/logist.sql 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。 :/var/www
The authenticity of host '[218.X.X.202]:2250 ([218.X.X.202]:2250)' can't be established.
ECDSA key fingerprint is SHA256:Uz6iC5uXv2duYNZUiv6uZnh20MSjTIuT6zqkea/8XSE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[218.X.X.202]:2250' (ECDSA) to the list of known hosts.
该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。 's password:
logist.sql 100% 57MB 285.5KB/s 03:25