当前位置: 首页 > news >正文

【ansible】Failed to connect to the host via ssh Permission denied

故障现象

yeqiang@yeqiang-MS-7B23:/data/VirtualBox VMs$ ansible all -m ping
node-2 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: \nAuthorized users only. All activities may be monitored and reported.\nyeqiang@node-2: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
    "unreachable": true
}
node-3 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: \nAuthorized users only. All activities may be monitored and reported.\nyeqiang@node-3: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
    "unreachable": true
}
node-1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: \nAuthorized users only. All activities may be monitored and reported.\nyeqiang@node-1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).",
    "unreachable": true
}

 

故障原因:

当前用户是yeqiang,而配置ssh-copy-id 是root,参考以下指令

ssh root@node-1
ssh root@node-2
ssh root@node-3

解决

ansible指令指定用户root即可

yeqiang@yeqiang-MS-7B23:/data/VirtualBox VMs$ ansible -u root  all -m ping
[WARNING]: Platform linux on host node-1 is using the discovered Python interpreter at /usr/bin/python, but future
installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
node-1 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
[WARNING]: Platform linux on host node-3 is using the discovered Python interpreter at /usr/bin/python3.9, but
future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
node-3 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.9"
    },
    "changed": false,
    "ping": "pong"
}
[WARNING]: Platform linux on host node-2 is using the discovered Python interpreter at /usr/bin/python3.9, but
future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
node-2 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.9"
    },
    "changed": false,
    "ping": "pong"
}

 

相关文章:

  • Python中模块
  • 让IIS支持.NET Web Api PUT和DELETE请求
  • 《web应用技术》第一次课后练习
  • 【热门话题】Yarn:新一代JavaScript包管理器的安装与使用
  • 网络七层模型之数据链路层:理解网络通信的架构(二)
  • Go第三方框架--gin框架(二)
  • 五种免费的Python开发环境及具体下载网址
  • Java与Go:字符串转IP
  • 2.6 IDE(集成开发环境)是什么
  • 最新ChatGPT/GPT4科研应用与AI绘图及论文高效写作教程
  • 【设计模式】中介者模式的应用
  • IDEA或Pycharm设置Python环境报Cannot set up a python SDK的某种解决方案——更换IDEA或Pycharm的版本
  • 高效物联网连接技术创新:ECWAN边缘协同自组网的未来——基于ChirpLAN窄带扩频技术的无线混合组网
  • 用于 Linux 运维的专门发行版,以及工具
  • 创新指南|如何将人工智能应用于未来的创新管理——并不断付诸实践
  • “Material Design”设计规范在 ComponentOne For WinForm 的全新尝试!
  • FineReport中如何实现自动滚屏效果
  • iOS编译提示和导航提示
  • JavaScript中的对象个人分享
  • jquery ajax学习笔记
  • JSONP原理
  • Laravel Telescope:优雅的应用调试工具
  • magento 货币换算
  • rc-form之最单纯情况
  • Vim Clutch | 面向脚踏板编程……
  • vuex 学习笔记 01
  • WinRAR存在严重的安全漏洞影响5亿用户
  • 包装类对象
  • 记录一下第一次使用npm
  • 爬虫进阶 -- 神级程序员:让你的爬虫就像人类的用户行为!
  • 使用 Node.js 的 nodemailer 模块发送邮件(支持 QQ、163 等、支持附件)
  • 用 Swift 编写面向协议的视图
  • #pragam once 和 #ifndef 预编译头
  • $分析了六十多年间100万字的政府工作报告,我看到了这样的变迁
  • (BFS)hdoj2377-Bus Pass
  • (C#)Windows Shell 外壳编程系列9 - QueryInfo 扩展提示
  • (二)Eureka服务搭建,服务注册,服务发现
  • (二)基于wpr_simulation 的Ros机器人运动控制,gazebo仿真
  • (附源码)spring boot智能服药提醒app 毕业设计 102151
  • (附源码)springboot车辆管理系统 毕业设计 031034
  • (附源码)ssm高校运动会管理系统 毕业设计 020419
  • (六)库存超卖案例实战——使用mysql分布式锁解决“超卖”问题
  • (没学懂,待填坑)【动态规划】数位动态规划
  • (七)Knockout 创建自定义绑定
  • (心得)获取一个数二进制序列中所有的偶数位和奇数位, 分别输出二进制序列。
  • ./indexer: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object fil
  • .jks文件(JAVA KeyStore)
  • .NET Core IdentityServer4实战-开篇介绍与规划
  • .NET Standard / dotnet-core / net472 —— .NET 究竟应该如何大小写?
  • .NetCore实践篇:分布式监控Zipkin持久化之殇
  • .net访问oracle数据库性能问题
  • ??javascript里的变量问题
  • [BJDCTF 2020]easy_md5
  • [bzoj1006]: [HNOI2008]神奇的国度(最大势算法)
  • [C/C++]数据结构 栈和队列()