# setting linux user password error with user command

**URL:** <https://forum.ansible.com/t/setting-linux-user-password-error-with-user-command/18538>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 18, 2015, 10:04am UTC](https://forum.ansible.com/t/setting-linux-user-password-error-with-user-command/18538 "2015-06-18T10:04:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Duprez](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jan\_Duprez](https://forum.ansible.com/u/Jan_Duprez)\
**Post date:** [June 18, 2015, 10:04am UTC](https://forum.ansible.com/t/setting-linux-user-password-error-with-user-command/18538/1 "2015-06-18T10:04:01Z")

</div>

I have a strange issue when setting passwords for a user with the user module, it seems to be mangling the password somehow. When i use a plain shell command to set the password it does work …

Code causing the error:

- name: Add user someuser usingAnsible user module  
user: name=someuser password=“{{ someuser\_password }}” groups=someuser,shadow append=yes state=present

Working workaround:

- name: Add user someuser using shell  
shell: (echo “{{ someuser\_password }}”; echo “{{ someuser\_password }}”) | sudo passwd someuser

Once present the user created does some password-authenticated java commands and when i use the erronous code this all fails.  
If i login to the machine manually and update the password while these calls are being made by the ansible run i see the commands start succeeding again.

The workaround gets me by for now but is not ideal

Sys info

ansible --version

ansible 1.9.1

installed from ubuntu repos w apt-get

Distributor ID: Ubuntu  
Description: Ubuntu 12.04.5 LTS  
Release: 12.04  
Codename: precise

(yeah i should be updating my ubuntu, i know… 🙂

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 18, 2015, 2:10pm UTC](https://forum.ansible.com/t/setting-linux-user-password-error-with-user-command/18538/2 "2015-06-18T14:10:43Z")

</div>

Per the documentation, the password argument should be an already crypted password:

Optionally set the user’s password to this crypted value

You can use the “password\_hash” filter to create an encrypted version such as:

password=“{{ someuser\_password|password\_hash }}”
