# \-u not being set when running ad-hoc ansible run?

**URL:** <https://forum.ansible.com/t/u-not-being-set-when-running-ad-hoc-ansible-run/32369>\
**Category:** Ansible Project\
**Created:** [March 3, 2020, 12:24am UTC](https://forum.ansible.com/t/u-not-being-set-when-running-ad-hoc-ansible-run/32369 "2020-03-03T00:24:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Miller](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@John\_Miller](https://forum.ansible.com/u/John_Miller)\
**Post date:** [March 3, 2020, 12:24am UTC](https://forum.ansible.com/t/u-not-being-set-when-running-ad-hoc-ansible-run/32369/1 "2020-03-03T00:24:46Z")

</div>

Hello everyone,

I’m trying to run the following ad hoc ansible command to run the date command remotely against an IP camera running Linux:

`  
myuser@myhost:$ ansible [camera.site.example.org](http://camera.site.example.org) -i /path/to/inventory -u root -k -m raw -a date

`

and receiving the following error:

`  
[camera.site.example.org](http://camera.site.example.org) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Invalid/incorrect password: Permission denied, please try again.”,  
“unreachable”: true  
}

`

Running with -vvv seems to suggest that the -u root option is not being applied:  
`  
myuser@myhost:$ ansible -vvv [camera.site.example.org](http://camera.site.example.org) -i /path/to/inventory -u root -k -m raw -a date  
ansible 2.9.3  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/home/myuser/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/site-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]  
Using /etc/ansible/ansible.cfg as config file  
SSH password:  
host\_list declined parsing /path/to/inventory as it did not pass its verify\_file() method  
script declined parsing /path/to/inventory as it did not pass its verify\_file() method  
auto declined parsing /path/to/inventory as it did not pass its verify\_file() method  
Parsed /path/to/inventory inventory source with ini plugin  
META: ran handlers  
\<[camera.site.example.org](http://camera.site.example.org)\> ESTABLISH SSH CONNECTION FOR USER: myuser  
\<[camera.site.example.org](http://camera.site.example.org)\> SSH: EXEC sshpass -d8 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o ‘User=“myuser”’ -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/22d4672695 -tt [camera.site.example.org](http://camera.site.example.org) date  
\<[camera.site.example.org](http://camera.site.example.org)\> (5, ‘’, ‘Permission denied, please try again.\r\n’)  
[camera.site.example.org](http://camera.site.example.org) | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Invalid/incorrect password: Permission denied, please try again.”,  
“unreachable”: true  
}

`

If I run the ssh command listed outside of ansible, substituting “root” for “myuser”, things work fine:

`  
myuser@myhost:$ ssh -C -o ControlMaster=auto -o ControlPersist=60s -o ‘User=“root”’ -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/22d4672695 -tt [camera.site.example.org](http://camera.site.example.org) date  
[root@camera.site.example.org](mailto:root@camera.site.example.org)’s password:  
Tue Mar 3 00:20:59 GMT 2020  
myuser@myhost:$

`

Any idea why the -u option isn’t being passed to the underlying ssh command?

John Miller
