rsync 跳过Authentication (yes/no)提

2021-06-09  本文已影响0人  langlyyy
The authenticity of host '10.20.11.66 (10.20.11.66)' can't be established.
ECDSA key fingerprint is SHA256:7kFhXBTEkim6YcQGwcibIeIcDU580Dk7C3GU0MBHxhU.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.202.11.66' (ECDSA) to the list of known hosts.```
![image.png](https://img.haomeiwen.com/i8989426/f168909fa45bd7c2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

第一次往一台机器上执行传输的时候都会提示确认,每次都需要输入yes,多了会比较麻烦,所以可以使用下面方法去掉这个提示。

增加这段参数-e "ssh -o PubkeyAuthentication=yes -o stricthostkeychecking=no" ,传输的时候就会省略输入密码提示

StrictHostKeyChecking=no 如果连接server的key在本地不存在,那么就自动添加到文件中(默认是known_hosts),并且给出一个警告。
PubkeyAuthentication=yes 秘钥认证

www@app-01:/data$ rsync -e "ssh -o PubkeyAuthentication=yes -o stricthostkeychecking=no" -av ./log.log www@10.202.16.72:`pwd`/
www@10.202.16.72's password: 
上一篇下一篇

猜你喜欢

热点阅读