Featured image of post ansible | 缓存ssh密钥避免每次输入密码

ansible | 缓存ssh密钥避免每次输入密码

背景

使用ansible时,为了避免每次执行任务都需要输入ssh密码,我们可以缓存ssh密钥。

ansible 缓存ssh密钥

  1. 启动 ssh-agent 后台程序

eval “$(ssh-agent -s)”

  1. 将密钥添加至 ssh-add,只输入一次密码

ssh-add ~/.ssh/xxx

  1. 验证密钥是否缓存成功

ssh-add -l

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy 🚀
文章发布: 58  |  文章总访问: ...
网站稳定运行: ...  |  网站总访问量: ...