# Permission denied using ansible-vault edit

**URL:** <https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667>\
**Category:** Ansible Project\
**Created:** [February 27, 2014, 7:02pm UTC](https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667 "2014-02-27T19:02:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [February 27, 2014, 7:02pm UTC](https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667/1 "2014-02-27T19:02:33Z")

</div>

I can encrypt and decrypt but i haven’t been able to get edit to work.

I’m running on a mac. In my bash\_profile i have aliases to sublime

---------- .bash\_profile --------------

alias edit=‘/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl’

# a sudo version for when you need to edit /opt/ or other sudo owned files

alias sedit=‘sudo /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl’

# define EDITOR or ansible-vault

# Tried several things

export EDITOR=edit # Command not found

alias EDITOR=edit # Permission denied

alias EDITO=sedit

---------- end .bash\_profile --------------

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** ansible-vault encrypt sudoers

Vault password:

Confirm Vault password:

Encryption successful

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** ansible-vault decrypt sudoers

Vault password:

Decryption successful

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** ansible-vault edit -d sudoers

Vault password:

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 182, in main

fn(args, options, parser)

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 141, in execute\_edit

this\_editor.edit\_file()

File “/Users/kbroughton/vcp/git/mentat/ansible/lib/ansible/utils/vault.py”, line 188, in edit\_file

call([EDITOR, tmp\_path])

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 522, in call

return Popen(\*popenargs, \*\*kwargs).wait()

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 709, in **init**

errread, errwrite)

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1326, in \_execute\_child

raise child\_exception

OSError: [Errno 13] Permission denied

ERROR: [Errno 13] Permission denied

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** alias EDITOR=sedit

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** ansible-vault edit -d sudoers

Vault password:

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 182, in main

fn(args, options, parser)

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 141, in execute\_edit

this\_editor.edit\_file()

File “/Users/kbroughton/vcp/git/mentat/ansible/lib/ansible/utils/vault.py”, line 188, in edit\_file

call([EDITOR, tmp\_path])

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 522, in call

return Popen(\*popenargs, \*\*kwargs).wait()

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 709, in **init**

errread, errwrite)

File “/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1326, in \_execute\_child

raise child\_exception

OSError: [Errno 13] Permission denied

ERROR: [Errno 13] Permission denied

**Also tried as sudo user**

\*\*[\*\ ***kbroughton@mb-kbroughton** : **lynx-ansible/dev-ansible** **+ (develop)]** sudo ansible-vault edit -d sudoers

Traceback (most recent call last):

File “/Users/kbroughton/vcp/git/mentat/ansible/bin/ansible-vault”, line 27, in

from ansible import utils

ImportError: No module named ansible

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [February 27, 2014, 7:32pm UTC](https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667/2 "2014-02-27T19:32:47Z")

</div>

Can you try setting EDITOR to vi, vim, or nano ?

---

<div class="post-metadata">

**Author:** ![Tim\_Gerla](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@Tim\_Gerla](https://forum.ansible.com/u/Tim_Gerla)\
**Post date:** [February 27, 2014, 7:46pm UTC](https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667/3 "2014-02-27T19:46:53Z")

</div>

This might be tough to get working because “subl” returns immediately to the shell after opening the file, which means ansible-vault can’t re-encrypt after you’re done editing. You should probably stick with encrypt/decrypt and editing manually. What would be really cool is a Sublime Text plugin for vault!

-Tim

---

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [February 28, 2014, 6:52pm UTC](https://forum.ansible.com/t/permission-denied-using-ansible-vault-edit/14667/4 "2014-02-28T18:52:59Z")

</div>

That was precisely the problem.  
export EDITOR=nano  
works fine.  
An ansible vault plugin for sublime… sounds nice.
