# remote\_user does not appear to be working correctly

**URL:** <https://forum.ansible.com/t/remote-user-does-not-appear-to-be-working-correctly/34230>\
**Category:** Ansible Project\
**Created:** [November 24, 2020, 7:51am UTC](https://forum.ansible.com/t/remote-user-does-not-appear-to-be-working-correctly/34230 "2020-11-24T07:51:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [November 24, 2020, 7:51am UTC](https://forum.ansible.com/t/remote-user-does-not-appear-to-be-working-correctly/34230/1 "2020-11-24T07:51:28Z")

</div>

I have a playbook that executes ‘emissary\_deploy.yml’ as an include:

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [November 24, 2020, 8:32am UTC](https://forum.ansible.com/t/remote-user-does-not-appear-to-be-working-correctly/34230/2 "2020-11-24T08:32:14Z")

</div>

> - name: Delete/link properties  
> &nbsp;&nbsp;hosts: emissary  
> &nbsp;&nbsp;remote\_user: remoteUser  
> &nbsp;&nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: Link all properties files  
> ...  
> The task executes as user 'ec2-user' when I'm expecting it to be  
> 'remoteUser':  
> ...  
> \*01:11:53\* \<172.17.70.215\> ESTABLISH SSH CONNECTION FOR USER: \*ec2-user\*

Variables will override playbook keywords. See "Precedence categories"  
[https://docs.ansible.com/ansible/latest/reference\_appendices/general\_precedence.html#precedence-categories](https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#precedence-categories)

There must be a variable \*ansible\_user\* or \*ansible\_ssh\_user\* or  
environment \*ANSIBLE\_REMOTE\_USER\* with the value \*ec2-user\*

See "ssh connection plugin"  
[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ssh\_connection.html#ansible-builtin-ssh-connect-via-ssh-client-binary](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ssh_connection.html#ansible-builtin-ssh-connect-via-ssh-client-binary)

For example, the playbook below

&nbsp;&nbsp;\> cat pb.yml  
&nbsp;&nbsp;- hosts: test\_01  
&nbsp;&nbsp;&nbsp;&nbsp;remote\_user: remoteUser  
&nbsp;&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- debug:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var: ansible\_user

gives (abridged)

&nbsp;&nbsp;\> ANSIBLE\_REMOTE\_USER=admin ansible-playbook pb.yml  
&nbsp;&nbsp;  
&nbsp;&nbsp;ok: [test\_01] =\>  
&nbsp;&nbsp;&nbsp;&nbsp;ansible\_user: admin

---

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [November 24, 2020, 10:03pm UTC](https://forum.ansible.com/t/remote-user-does-not-appear-to-be-working-correctly/34230/3 "2020-11-24T22:03:52Z")

</div>

That was it. Thank you very much.
