# Ssh connectivity issues with ad-hoc commands, playbooks.yml, Ansible.

**URL:** <https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 14, 2023, 3:23pm UTC](https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105 "2023-06-14T15:23:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gonzalo\_diaz\_larenas](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@gonzalo\_diaz\_larenas](https://forum.ansible.com/u/gonzalo_diaz_larenas)\
**Post date:** [June 14, 2023, 3:23pm UTC](https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105/1 "2023-06-14T15:23:08Z")

</div>

Dear  
Good afternoon, sorry for the inconvenience, I’m just getting started with what Ansible is, specifically learning how to optimize daily tasks in laboratories. I set up a virtualized network with a central ansible server, from where I apply ad-hoc commands and automated playbooks.yml files that point to remote hosts, I managed to configure three machines with different Debian distributions, I can connect via ssh without any problem, each machine has the corresponding public key, which I copied from the central server, that is, every time I connect via ssh it does not ask me for a password, this is a fundamental requirement when applying ad-hoc or playbook commands, with these machines I have no problems of ssh connectivity. I wanted to expand the network by adding a group called ClientWindows to the inventory file, which will host computers with Microsoft Windows 10 Pro, via ssh I can connect directly to this type of machine without any problem, I also configure them so that they do not ask me for the password when applying ad-hoc or playbook.yml commands, but here comes a problem, every time I apply an ad-hoc or playbook.yml command it gives me connectivity problems via ssh (Permission denied), when I see the connectivity error I deduce that by default ssh points to the root user, but it turns out that I am trying to connect to a machine with Windows 10 Pro that has the administrator username, the strange thing about all this is that when I connect via ssh directly (ssh administrator@x.x.x.x ) I have no problem, in fact I have configured the ssh connection so that it does not ask me for a password, I am attaching a file with the details of what I mentioned earlier, I would appreciate your guidance, regards.

 ![Problemas de conectividad ssh Windows.JPG](https://us1.discourse-cdn.com/ansible/original/2X/d/d236df59469ce9b93c5b3cacff5ce2ff480a245b.jpeg)

---

<div class="post-metadata">

**Author:** ![Prady\_A](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/prady_a/32/4792_2.png) [@Prady\_A](https://forum.ansible.com/u/Prady_A)\
**Post date:** [June 15, 2023, 5:30am UTC](https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105/2 "2023-06-15T05:30:01Z")

</div>

You are running the script from root user. So it is trying to connect root@ip not administrator@ip

> **(attachments)**
>
> ![Problemas de conectividad ssh Windows.JPG](https://us1.discourse-cdn.com/ansible/original/2X/d/d236df59469ce9b93c5b3cacff5ce2ff480a245b.jpeg)

---

<div class="post-metadata">

**Author:** ![Thanh\_Nguyen\_Duc](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@Thanh\_Nguyen\_Duc](https://forum.ansible.com/u/Thanh_Nguyen_Duc)\
**Post date:** [June 15, 2023, 6:35am UTC](https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105/3 "2023-06-15T06:35:45Z")

</div>

Need to specify your target ssh user.

---

<div class="post-metadata">

**Author:** ![Prady\_A](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/prady_a/32/4792_2.png) [@Prady\_A](https://forum.ansible.com/u/Prady_A)\
**Post date:** [June 15, 2023, 6:47am UTC](https://forum.ansible.com/t/ssh-connectivity-issues-with-ad-hoc-commands-playbooks-yml-ansible/38105/4 "2023-06-15T06:47:46Z")

</div>

in ansible.cfg configuration file you can specify  
Remote\_user = administrator
