# ansible winrm : the specified credentials were rejected by the server

**URL:** <https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [February 14, 2017, 12:29pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726 "2017-02-14T12:29:26Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamdi\_Ben\_Zekri](https://avatars.discourse-cdn.com/v4/letter/h/3e96dc/32.png) [@Hamdi\_Ben\_Zekri](https://forum.ansible.com/u/Hamdi_Ben_Zekri)\
**Post date:** [February 14, 2017, 12:29pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/1 "2017-02-14T12:29:26Z")

</div>

Hi,  
I’m using ansible on centos 7 guest on virtualBox using a bridged network with a windows host  
they can both ping each other. (windows address: 192.168.1.2, centos7 address: 192.168.1.3)  
I’m using a basic winrm connection and I’ve already executed configureRemotingForAnsible.ps1 successfuly on the host along with these two commands:

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

I’ve also disabled firewall on both sides.

My windows account is not part of any Domain.

ansible version is 2.2.1.0  
the inventory file: inv.ini

[windowsTest]  
192.168.1.2  
[windowsTest:vars]  
ansible\_username=myUsername  
ansible\_password=myPassword  
ansible\_port=5985  
ansible\_connection=winrm  
ansible\_winrm\_scheme=http  
ansible\_winrm\_server\_cert\_validation=ignore  
ansible\_winrm\_transport=basic

when I execute :

$ ansible windowsTest -i inv.ini -m win\_ping

I get this error:

192.168.1.2 |Unreachable! =\> {  
“changed”: false,  
“msg”: “basic: the specified credentials were rejected by the server”,  
“unreachable”: true  
}

any Help?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [February 15, 2017, 11:56am UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/2 "2017-02-15T11:56:52Z")

</div>

“the specified credentials were rejected by the server” can often mean the password doesn’t match what’s expected for the user name.

Are you using a domain login? If so you’ll need to set up the kerberos support. If not check the windows event log to see which user it reckons you are logging in as.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [February 15, 2017, 1:13pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/3 "2017-02-15T13:13:32Z")

</div>

Could you run this with -vvvv added ?

It may give you some more information to what is going on.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [February 16, 2017, 6:14am UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/4 "2017-02-16T06:14:20Z")

</div>

Pretty sure thats not a password issue, I think the error text is different.

Is the user a member of administrators?

---

<div class="post-metadata">

**Author:** ![Hamdi\_Ben\_Zekri](https://avatars.discourse-cdn.com/v4/letter/h/3e96dc/32.png) [@Hamdi\_Ben\_Zekri](https://forum.ansible.com/u/Hamdi_Ben_Zekri)\
**Post date:** [February 16, 2017, 9:13am UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/5 "2017-02-16T09:13:10Z")

</div>

Yes the password is correct and no the user is a standard one not an admin  
is it necessary to be admin to just use win\_ping??

---

<div class="post-metadata">

**Author:** ![Hamdi\_Ben\_Zekri](https://avatars.discourse-cdn.com/v4/letter/h/3e96dc/32.png) [@Hamdi\_Ben\_Zekri](https://forum.ansible.com/u/Hamdi_Ben_Zekri)\
**Post date:** [February 16, 2017, 10:12am UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/6 "2017-02-16T10:12:20Z")

</div>

no I’m not using a domain login, just a normal user (not an admin) , the User Account Control is disabled.

update:  
I’ve tried to win\_ping to the admin account and it work, the thing is I need it to work with just a normal account

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [February 28, 2017, 2:02pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/7 "2017-02-28T14:02:40Z")

</div>

Winrm is intended for system administration, so using with a regular, non administrator user might not have sufficient grants/permissions.

Can you make your local user a local administrator perhaps?

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [March 26, 2017, 9:17pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/8 "2017-03-26T21:17:59Z")

</div>

I think it’s possible to tweak the winrm service to allow non-admin logins but still - lots of the operations you perform against the server requires administrator proveliges anyways so I don’t see the point in spending time on it.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 26, 2017, 11:02pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/9 "2017-03-26T23:02:49Z")

</div>

You definitely can allow a non admin account to run through WinRM but it is definitely not something that is enabled by default and would require some fiddling with the SSDL and endpoint ACLs. This issue has most of the information that is required to add a non admin [https://github.com/ansible/ansible/issues/16478](https://github.com/ansible/ansible/issues/16478). Trond is right though usually you require admin priviledges to do anything in Windows like install applications or change config so I don’t see there being a large case for this in Ansible. Happy to be proven otherwise though.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [March 27, 2017, 9:15pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/10 "2017-03-27T21:15:30Z")

</div>

More interesting would be to use restricted endpoints, which lets you execute stuff as a different user as the one you’re logging in with. That way you’d have one credential that would actually do all the things, and another credential to connect with. Unsure whether pywinrm supports it - maybe Matt would know?

---

<div class="post-metadata">

**Author:** ![nhsxibo](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nhsxibo](https://forum.ansible.com/u/nhsxibo)\
**Post date:** [July 16, 2018, 7:52pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/11 "2018-07-16T19:52:10Z")

</div>

Hello Hmdi,

Did you solve this problem? I had the same error message as you. I set up a local service account on a windows server and I can’t ping that server using win\_ping. Does that user have to be part of administration group or standard group?

Thanks!

---

<div class="post-metadata">

**Author:** ![Karoly\_VEGH](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Karoly\_VEGH](https://forum.ansible.com/u/Karoly_VEGH)\
**Post date:** [September 11, 2018, 11:12am UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/12 "2018-09-11T11:12:50Z")

</div>

I can’t thank you enough for the AllowUnencrypted=“true” part.  
This was the last drop to enable my config working.

If you’re ever in Vienna/Austria, you’re in for a coffee.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [September 11, 2018, 8:05pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/13 "2018-09-11T20:05:51Z")

</div>

I can’t stress this enough, do not set AllowUnencrypted=“true” on your Windows hosts. This may have been needed a few years ago but today you can easily set up a HTTPS listener with a self signed certificate or use message encryption with NTLM, Kerberos or CredSSP authentication. If you do set this then you could be paying more than just the price of a coffee once a hacker has seen all the WinRM communication in plaintext.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Karoly\_VEGH](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Karoly\_VEGH](https://forum.ansible.com/u/Karoly_VEGH)\
**Post date:** [September 11, 2018, 11:11pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/14 "2018-09-11T23:11:14Z")

</div>

I completely agree.  
Yet, this was only a demo environment and this was the easiest way to get the damn winrm working from ansible - of course it is not an option for production.

wbr,

charlie

---

<div class="post-metadata">

**Author:** ![Mike\_V](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mike\_V](https://forum.ansible.com/u/Mike_V)\
**Post date:** [March 13, 2019, 4:55pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/15 "2019-03-13T16:55:51Z")

</div>

Thank you for this thread! Also had to change network profile to private, then run the winrm set command

---

<div class="post-metadata">

**Author:** ![Aviya\_Singh](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@Aviya\_Singh](https://forum.ansible.com/u/Aviya_Singh)\
**Post date:** [June 17, 2019, 2:02pm UTC](https://forum.ansible.com/t/ansible-winrm-the-specified-credentials-were-rejected-by-the-server/23726/16 "2019-06-17T14:02:59Z")

</div>

Hi,

I have tried the below activity and still I am getting the same error.

Any Help?
