# Missing sudo password

**URL:** <https://forum.ansible.com/t/missing-sudo-password/4561>\
**Category:** Get Help\
**Tags:** ad-hoc\
**Created:** [March 25, 2024, 6:40pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561 "2024-03-25T18:40:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![halavehzadeh](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/halavehzadeh/32/2608_2.png) [@halavehzadeh](https://forum.ansible.com/u/halavehzadeh)\
**Post date:** [March 25, 2024, 6:40pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561/1 "2024-03-25T18:40:14Z")

</div>

I’m trying to run ad-hoc command and use privilege access to run the command here is what I try to running :

```auto
ansible localhost -m service -a "name=httpd state=started" -b -k

```

After I enter my SSH password I get bellow message:

```auto
SSH password:
127.0.0.1 | FAILED! => {
    "msg": "Missing sudo password"
}

```

any one have had this issue before?

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [March 25, 2024, 6:45pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561/2 "2024-03-25T18:45:00Z")

</div>

You need to add “-K” for asking the become password. It will re-use the ssh password if you leave it blank, but it is a required flag if a password is required for your become method.

---

<div class="post-metadata">

**Author:** ![halavehzadeh](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/halavehzadeh/32/2608_2.png) [@halavehzadeh](https://forum.ansible.com/u/halavehzadeh)\
**Post date:** [March 25, 2024, 7:02pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561/3 "2024-03-25T19:02:57Z")

</div>

Thanks , It is working now , I thought is small “k”

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [March 25, 2024, 7:32pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561/4 "2024-03-25T19:32:20Z")

</div>

`ansible --help`

extract:

```auto
-K, --ask-become-pass ask for privilege escalation password

-k, --ask-pass ask for connection password

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 24, 2024, 7:33pm UTC](https://forum.ansible.com/t/missing-sudo-password/4561/5 "2024-04-24T19:33:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
