# How can I connect to Windows Server using WinRM without password(like linux ssh authentication)?

**URL:** <https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 16, 2020, 3:51am UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989 "2020-01-16T03:51:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jiwoong\_Lee](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@Jiwoong\_Lee](https://forum.ansible.com/u/Jiwoong_Lee)\
**Post date:** [January 16, 2020, 3:51am UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989/1 "2020-01-16T03:51:33Z")

</div>

Hi, all.

Now I can connect to Linux server without password, It just using SSH key.

And I need to connect Windows Server using WinRM but it need to Windows account and password.

How can I connect to Windows Server without password?

Please let me know any methods.

---

<div class="post-metadata">

**Author:** ![renu\_jessi](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@renu\_jessi](https://forum.ansible.com/u/renu_jessi)\
**Post date:** [January 16, 2020, 6:28am UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989/2 "2020-01-16T06:28:24Z")

</div>

## WinRM HTTPS Listener

The ConfigWinRMListenerPlugin configures a WinRM HTTPS listener with a self signed certificate generated on the spot and enables (optionally) basic authentication, which means that a secure communication channel can be established between any client and the server being provisioned, without the requirement of having both the client and the server in the same domain. A firewall rule is added by cloudbase-init in the Windows firewall for TCP port 5986.

A this point you can login into your server. To begin with, don’t forget to add a rule to your security groups in OpenStack!

> 1  
>   
> |   
>   
> nova secgroup-add-rule default tcp 5986 5986 0.0.0.0/0  
>   
> |
> 
> - | - |

Get the admin password for the instance:

> 1  
>   
> |   
>   
> nova get-password yourinstance ~/.ssh/your\_ssh\_rsa\_key  
>   
> |
> 
> - | - |

On your client connect to your instance as shown in the following PowerShell snippet:

---

<div class="post-metadata">

**Author:** ![Jiwoong\_Lee](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@Jiwoong\_Lee](https://forum.ansible.com/u/Jiwoong_Lee)\
**Post date:** [January 17, 2020, 6:58am UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989/3 "2020-01-17T06:58:07Z")

</div>

Thanks for reply jessi,

I think your mentioned commands for openstack environment isn’t it?

Could you please easily and further explain how can I connect to Ansible Server to Windows without password.

Thanks,

2020년 1월 16일 목요일 오후 3시 28분 25초 UTC+9, renu jessi 님의 말:

---

<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:** [January 17, 2020, 10:47am UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989/4 "2020-01-17T10:47:32Z")

</div>

If using WinRM your only “password less” options are certificate based auth which is a massive pain to setup and I would not recommend it or Kerberos. With Kerberos you can use kinit before running Ansible to get a token that is then used for subsequent authentication. Kinit also works with a pre generated key tab so you don’t need to set the password.

A final option is to use SSH with Windows with key auth. This is a fairly recent feature and it may still have some bugs but it does work.

---

<div class="post-metadata">

**Author:** ![Stu](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Stu](https://forum.ansible.com/u/Stu)\
**Post date:** [January 21, 2020, 2:09pm UTC](https://forum.ansible.com/t/how-can-i-connect-to-windows-server-using-winrm-without-password-like-linux-ssh-authentication/31989/5 "2020-01-21T14:09:57Z")

</div>

[https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh\_install\_firstuse](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse)

Openssh server on windows is fairly new but I’ve been able to ssh with key to a windows server and run PowerShell commands.
