# Ansible ping get FAILED =\> SSH Error: Permission denied

**URL:** <https://forum.ansible.com/t/ansible-ping-get-failed-ssh-error-permission-denied/20322>\
**Category:** Ansible Project\
**Created:** [January 22, 2016, 7:18pm UTC](https://forum.ansible.com/t/ansible-ping-get-failed-ssh-error-permission-denied/20322 "2016-01-22T19:18:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hongjun\_Ma](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@Hongjun\_Ma](https://forum.ansible.com/u/Hongjun_Ma)\
**Post date:** [January 22, 2016, 7:18pm UTC](https://forum.ansible.com/t/ansible-ping-get-failed-ssh-error-permission-denied/20322/1 "2016-01-22T19:18:44Z")

</div>

I’m getting permission error on basic ansible ping command. I verified ssh to remote hostname and ip address so the ssh host key is not an issue. Using CentOS7.0

If I cut/paste ssh command in ansible debug, the output will indicate I don’t have access privilege to control path under /root. I wonder why Ansible use default root path while I’m executing ansible from sudo user test.

[test@hjma291 ~]$ sudo ansible apacheweb -m ping -vvvv

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 26, 2016, 4:34am UTC](https://forum.ansible.com/t/ansible-ping-get-failed-ssh-error-permission-denied/20322/2 "2016-01-26T04:34:51Z")

</div>

well .. when you 'sudo ansible' you are running ansible as root, since  
it creates things in ~/.ansible ... in this case ~/ translates to  
/root

when you copy and paste the ssh command, YOU are not root nor running  
sudo, hence the difference.

normally you don't run anible inside sudo, what are you trying to accomplish?
