# "Unable to open shell" when not running playbook as sudo

**URL:** <https://forum.ansible.com/t/unable-to-open-shell-when-not-running-playbook-as-sudo/26871>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [February 28, 2018, 11:33pm UTC](https://forum.ansible.com/t/unable-to-open-shell-when-not-running-playbook-as-sudo/26871 "2018-02-28T23:33:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Bartik](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@Bryan\_Bartik](https://forum.ansible.com/u/Bryan_Bartik)\
**Post date:** [February 28, 2018, 11:33pm UTC](https://forum.ansible.com/t/unable-to-open-shell-when-not-running-playbook-as-sudo/26871/1 "2018-02-28T23:33:18Z")

</div>

I have a playbook that backups router configs using the ios\_config module. When I run the command as sudo it works but the files it creates are owned by root. I want them owned by me. However when I run the ansible-playbook command without sudo it fails and gives the errors below. Any ideas what I need to change to get this to work?

bryan@ubuntu:~/mine/cfg-backup$ ansible-playbook -vvv cfg-backup.yml

…

\<192.168.9.201\> using connection plugin network\_cli  
\<192.168.9.202\> using connection plugin network\_cli  
\<192.168.9.203\> using connection plugin network\_cli  
fatal: [192.168.9.202]: FAILED! =\> {  
“changed”: false,  
“msg”: “unable to open shell. Please see: [https://docs.ansible.com/ansible/network\_debug\_troubleshooting.html#unable-to-open-shell](https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell)”  
}  
fatal: [192.168.9.201]: FAILED! =\> {  
“changed”: false,  
“msg”: “unable to open shell. Please see: [https://docs.ansible.com/ansible/network\_debug\_troubleshooting.html#unable-to-open-shell](https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell)”  
}  
fatal: [192.168.9.203]: FAILED! =\> {  
“changed”: false,  
“msg”: “unable to open shell. Please see: [https://docs.ansible.com/ansible/network\_debug\_troubleshooting.html#unable-to-open-shell](https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell)”  
}

Thanks,

Bryan

---

<div class="post-metadata">

**Author:** ![Bryan\_Bartik](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@Bryan\_Bartik](https://forum.ansible.com/u/Bryan_Bartik)\
**Post date:** [March 1, 2018, 1:31pm UTC](https://forum.ansible.com/t/unable-to-open-shell-when-not-running-playbook-as-sudo/26871/2 "2018-03-01T13:31:03Z")

</div>

I think I figured it out. There are directories in ~/.ansible that were owned by root that need to be writeable by the user running ansible. They were owned by root probably because I ran the playbook as sudo the first time. I chowned these and now everything is fine.
