# Executable vault password file doesnt work

**URL:** <https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402>\
**Category:** Ansible Project\
**Created:** [January 6, 2021, 11:59am UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402 "2021-01-06T11:59:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankur\_Porwal](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Ankur\_Porwal](https://forum.ansible.com/u/Ankur_Porwal)\
**Post date:** [January 6, 2021, 11:59am UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/1 "2021-01-06T11:59:45Z")

</div>

Hi All,

I hope you all are doing good in these trying times !!

I am working on a POC for using a executable file as my ansible vault password.

So my ansible command to run playbook looks something like this

ansible-playbook srev\_user.yml --vault-id /etc/ansible/my-client.py -vvv

and my-client.py script looks like this

import subprocess  
cmd = subprocess.Popen([“echo”, “abc123”])  
cmd.wait()

so this script output to “abc123” which is my ansible password.

But this doesnt work and shows bellow error

**[WARNING]: Error in vault password file loading (None): Problem running vault password client script /etc/ansible/my-client.py ([Errno 8] Exec**  
**format error). If this is not a script, remove the executable bit from the file.**  
**ERROR! Problem running vault password client script /etc/ansible/my-client.py ([Errno 8] Exec format error). If this is not a script, remove the executable bit from the file.**

Please suggest on the same.

Regards,  
Ankur Porwal

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [January 6, 2021, 12:04pm UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/2 "2021-01-06T12:04:25Z")

</div>

What are the ownership and permissions on that file?

Antony.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 6, 2021, 12:07pm UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/3 "2021-01-06T12:07:54Z")

</div>

Hi,

> \> ERROR! Problem running vault password client script  
> \> /etc/ansible/my-client.py ([Errno 8] Exec format error). If this is  
> \> not a script, remove the executable bit from the file.\*
> 
> What are the ownership and permissions on that file?

from the error message, it looks like it is executable.

Maybe the shebang ([https://en.wikipedia.org/wiki/Shebang\_(Unix)](https://en.wikipedia.org/wiki/Shebang_(Unix))) is  
missing inside the script?

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![Ankur\_Porwal](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Ankur\_Porwal](https://forum.ansible.com/u/Ankur_Porwal)\
**Post date:** [January 6, 2021, 12:10pm UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/4 "2021-01-06T12:10:20Z")

</div>

I have provided full permission ‘777’ on the file my-client.py

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [January 6, 2021, 12:22pm UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/5 "2021-01-06T12:22:12Z")

</div>

Ugh!

Please change that to 700 and ensure that it is owned by the ansible user.

Also check the shebang line (which wasn't quoted in your original posting) as  
suggested by Felix.

Antony.

---

<div class="post-metadata">

**Author:** ![Ankur\_Porwal](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Ankur\_Porwal](https://forum.ansible.com/u/Ankur_Porwal)\
**Post date:** [January 6, 2021, 1:50pm UTC](https://forum.ansible.com/t/executable-vault-password-file-doesnt-work/34402/6 "2021-01-06T13:50:51Z")

</div>

Thank you Felix and Antony.

After changing permission and adding shebang it worked.

Regards,  
Ankur Porwal
