[英]How to enter private key password with ansible
I have the vagrant virtual machine
running.我正在运行 vagrant
virtual machine
。
I can ssh
into it using ssh vagrant@192.168.0.28
then it ask me the pass phrase for the private key, which I can enter and then it logs me in.我可以
ssh
使用ssh vagrant@192.168.0.28
vagrant@192.168.0.28 进入它然后它问我私钥的密码短语,我可以输入它然后它让我登录。
but if I use:但如果我使用:
ansible all -m ping
then I get this:然后我得到这个:
192.168.0.28 | FAILED => FAILED: ssh moor@192.168.0.28:22 : Private key file is encrypted
To connect as a different user, use -u <username>.
How can I enter pass phrase in ansible?如何在 ansible 中输入密码?
I tried ansible -k
but it says authentication failed.我试过
ansible -k
但它说身份验证失败。
Try using ssh
as the transport. 尝试使用
ssh
作为传输。 Generally, Ansible uses paramiko
which is not as friendly for interactive sessions: 通常,Ansible使用的
paramiko
对交互式会话不友好:
ansible all -c ssh -m ping
If that doesn't work, I didn't see anything on running Ansible with an ssh key pass phrase on the documentation or in the code, so you might have to remove it with something like this: 如果这不起作用,我没有看到在文档或代码中使用ssh密钥密码运行Ansible的任何内容,因此您可能必须使用以下内容删除它:
openssl rsa -in private_key_with_pass_phrase -out private_key_without_pass_phrase
i have tried我努力了
cd ~/.ssh/
openssl rsa -in id_rsa -out id_rsa_without_pass_phrase
and got error并得到错误
unable to load Private Key
routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY
solution was to run this command:解决方案是运行此命令:
cd ~/.ssh/
ssh-keygen -p -f id_rsa -m PEM
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.