Ansible:部署管理windows机器遇到的问题(异常提示:plaintext: the specified credentials were rejected by the server )

1.异常提示:plaintext: the specified credentials were rejected by the server (明文:指定的凭据被服务器拒绝)
在这里插入图片描述

异常提示:plaintext: the specified credentials were rejected by the server (明文:指定的凭据被服务器拒绝)
解决办法:
Windows没有开启被远程管理的权限
在Windows Power Shell中执行下面命令

set-executionpolicy remotesigned
winrm quickconfig
winrm set winrm/config/service/auth ‘@{Basic=“true”}’
winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’


因为进行远程powershell管理必须需要启用winrm的服务,所以需要在windows平台上启用winrm服务
(1)winrm service 默认都是未启用的状态,先查看状态;如无返回信息,则是没有启动;
winrm enumerate winrm/config/listener
(2)针对winrm service 进行基础配置,默认的快速配置使用以下命令(含启动WinRM服务,并设置服务为自动启动):
winrm quickconfig
(3)查看winrm service listener:
winrm e winrm/config/listener
(4)为winrm service 配置auth:
winrm set winrm/config/service/auth ‘@{Basic=“true”}’
(5)为winrm service 配置加密方式为允许非加密:
winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’

注意1

如果修改上面配后还报继续报拒绝服务凭据错误,有可能是ansible主机清单中windows服务器密码提供错误!!!!!!(大坑)

注意2:如果不设置AllowUnencrypted=“true”,走http的时候会报服务器拒绝凭证:

plaintext: the specified credentials were rejected by the server

设置为Basic=true,Basic是最低安全性的认证方式:

Basic authentication
The user name and password sent in the authentication exchange. Basic authentication can be configured to use either HTTP or HTTPS transport in a domain or workgroup. This method is the least secure method of authentication.

其他认证方式详见官方文档:Authentication for Remote Connections 及术语解释:Windows Remote Management Glossary


#下面命令可以查看winrm服务(5985端口)是否开启
netsh http show servicestate

在这里插入图片描述

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

侯侯Hou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值