ssh 免密登录
今天在使用scp命令拷贝文件时候发生以下错误
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:HDjXJvu0VYXWF+SKMZjSGn4FQmg/+w6eV9ljJvIXpx0.
Please contact your system administrator.
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:46
ECDSA host key for 108.61.163.242 has changed and you have requested strict checking.
Host key verification failed.
查询后发现需要以下命令即可解决
ssh-keygen -R 你要访问的IP地址
参考
于是后面开始配置ssh免密登录,参考
- https://blog.csdn.net/xyang81/article/details/51477925
其中在拷贝公钥到目标服务器的authorized_keys上时,发现没有这个目录。然后使用命令创建文件,将公钥拷贝进去。
拷贝之后需要将authorized_keys文件更改目录权限
chmod 644 authorized_keys
参考