# Privilege escalation error when running a sudo command on AWS Ubuntu machine

**URL:** <https://forum.ansible.com/t/privilege-escalation-error-when-running-a-sudo-command-on-aws-ubuntu-machine/33568>\
**Category:** Ansible Project\
**Tags:** ubuntu, aws\
**Created:** [August 7, 2020, 8:53pm UTC](https://forum.ansible.com/t/privilege-escalation-error-when-running-a-sudo-command-on-aws-ubuntu-machine/33568 "2020-08-07T20:53:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lovesh\_harchandani](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@lovesh\_harchandani](https://forum.ansible.com/u/lovesh_harchandani)\
**Post date:** [August 7, 2020, 8:53pm UTC](https://forum.ansible.com/t/privilege-escalation-error-when-running-a-sudo-command-on-aws-ubuntu-machine/33568/1 "2020-08-07T20:53:09Z")

</div>

Hi.  
I am trying to install a package on an AWS Ubuntu machine using ansible and getting error

FAILED! =\> {“msg”: "Timeout (42s) waiting for privilege escalation prompt: "}

I have tried with high timeouts as suggested online. The package I am trying to install is docker and so it should take much time.  
Moreover, I am watching the file /var/log/auth.log while I run the playbook but cannot see any activity.  
_I am able to do non-sudo actions however._

My ansible playbook is as follows

- hosts: ‘{{ host }}’  
tasks:
- name: run lsb\_releaset to check SSH works  
shell: lsb\_release -a
- name: Install docker if not already  
become: yes  
become\_method: su  
package:  
name: “docker-ce”  
state: present

And my hosts file is as

[node]

[node:vars]  
ansible\_ssh\_user=ubuntu  
ansible\_ssh\_private\_key\_file=

I am running ansible as

ansible-playbook -i hosts playbook.yml --extra-vars “host=node” -T 40 -v

---

<div class="post-metadata">

**Author:** ![lovesh\_harchandani](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@lovesh\_harchandani](https://forum.ansible.com/u/lovesh_harchandani)\
**Post date:** [August 7, 2020, 11:18pm UTC](https://forum.ansible.com/t/privilege-escalation-error-when-running-a-sudo-command-on-aws-ubuntu-machine/33568/2 "2020-08-07T23:18:32Z")

</div>

Resolved by changing _su_ to _sudo_ in _become\_method_, i.e. changing become\_method:su to become\_method: su **do\*\*\*\*.** The docs mention **su** however. Is this a bug in Ansible itself where it say in the error message that _su_ is not acceptable or are _su_ and _sudo_ meant to do different things?

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [August 8, 2020, 6:50am UTC](https://forum.ansible.com/t/privilege-escalation-error-when-running-a-sudo-command-on-aws-ubuntu-machine/33568/3 "2020-08-08T06:50:06Z")

</div>

Hi,

su and sudo are two ways to become another user. So both method are available in ansible. Very often indeed in public cloud, this is the sudo way which is used during the provisionning of the server and assigning ssh key

“man su” and “man sudo” should help you to understand differences.

Regards,

JYL
