# Login/Password encryption in host file

**URL:** <https://forum.ansible.com/t/login-password-encryption-in-host-file/32609>\
**Category:** Ansible Project\
**Created:** [April 6, 2020, 8:04pm UTC](https://forum.ansible.com/t/login-password-encryption-in-host-file/32609 "2020-04-06T20:04:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Sagar](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Ashish\_Sagar](https://forum.ansible.com/u/Ashish_Sagar)\
**Post date:** [April 6, 2020, 8:04pm UTC](https://forum.ansible.com/t/login-password-encryption-in-host-file/32609/1 "2020-04-06T20:04:34Z")

</div>

Hi,

Is there anyway to only encrypt Device login/password credentials in hosts file ? If so, Where should encryption key be saved and how to use it for decrypt ?

Thanks in Advace.

-Ashish

---

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [April 14, 2020, 12:48pm UTC](https://forum.ansible.com/t/login-password-encryption-in-host-file/32609/2 "2020-04-14T12:48:50Z")

</div>

Ansible Documentation is a wonderful place. Did you try searching for the solution? Try the following doc, it has got all the scenarios.  
[https://docs.ansible.com/ansible/latest/user\_guide/vault.html](https://docs.ansible.com/ansible/latest/user_guide/vault.html)

You can use group vars directory and create yml files with group names with encrypted credential values.

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [April 14, 2020, 11:20pm UTC](https://forum.ansible.com/t/login-password-encryption-in-host-file/32609/3 "2020-04-14T23:20:43Z")

</div>

You could use vault / hash or shadow your password and use that hashed value. Or you could add you job to a CI/CD pipeline add your credentials into that pipeline which will be hashed out on Stdout
