首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >强制不能使用SSH密码

强制不能使用SSH密码
EN

Stack Overflow用户
提问于 2022-06-06 22:59:41
回答 1查看 352关注 0票数 2

我正在尝试使用Ansible来设置主机,这些主机最初只能通过SSH使用密码(不是密钥文件)访问(是的,我的第一本游戏是设置基于密钥的访问)。

我可以从命令行使用SSH密码访问主机。

在详细模式下运行Ansible提供以下输出

代码语言:javascript
复制
EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="debian"' -o ConnectTimeout=30 -o ControlPath=/home/home/.ansible/cp/2d22e058dc 192.168.122.11 '/bin/sh -c '"'"'echo ~debian && sleep 0'"'"''
<192.168.122.11> (255, b'', b'OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/home/.ssh/config
...
debug3: no such identity: /home/home/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
debian@192.168.122.11: Permission denied (publickey,password).

看起来,SSH客户端被迫不使用密码PasswordAuthentication=no,而输出的其余部分中没有任何显示它正在尝试的东西。

这是我的主机文件(不,它们不是真正的密码)

代码语言:javascript
复制
all:
  children:
    init:
      hosts:
        bullseye-apps:
        bullseye-backup:
      vars:
        ansible_ssh_pass: 'password'
        ansible_become_pass: 'password'

所以我想我应该让Ansible选择使用密码。

我按以下方式运行我的剧本

代码语言:javascript
复制
ansible-playbook -i test-hosts.yml playbook.yml

我最近升级了我的操作系统(升级到Pop_OS!22.04),并且已经有一段时间没有运行这些游戏了,所以可能是Ansible中的一个变化吗?

代码语言:javascript
复制
$ ansible --version
ansible 2.10.8
  config file = /home/home/Projects/federated-agency/ansible.cfg
  configured module search path = ['/home/home/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2022-06-07 02:57:17

看来我拼错了其中一个主机的用户名,该死!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72524252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档