# Unable to run sudo commands on remote server

**URL:** <https://forum.ansible.com/t/unable-to-run-sudo-commands-on-remote-server/36305>\
**Category:** Ansible Project\
**Created:** [February 8, 2022, 8:09pm UTC](https://forum.ansible.com/t/unable-to-run-sudo-commands-on-remote-server/36305 "2022-02-08T20:09:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralph\_Hershkowitz](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@Ralph\_Hershkowitz](https://forum.ansible.com/u/Ralph_Hershkowitz)\
**Post date:** [February 8, 2022, 8:09pm UTC](https://forum.ansible.com/t/unable-to-run-sudo-commands-on-remote-server/36305/1 "2022-02-08T20:09:06Z")

</div>

I am on server A logged in as user A with sudo permissions. I am attempting to run a privileged command on server b as user A. User A on server b also has sudo permissions. However I am getting permission errors:

[rhershkow@if21d0002 ansible]$ ansible-playbook example.yml

PLAY [New user is created] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ok: [if21d0001]

TASK [User gets created] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* fatal: [if21d0001]: FAILED! =\> {“changed”: false, “msg”: “useradd: Permission denied.\nuseradd: cannot lock /etc/passwd; try again later.\n”, “name”: “test”, “rc”: 1} to retry, use: --limit @/home/rhershkow/demo/ansible/example.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* if21d0001 : ok=1 changed=0 unreachable=0 failed=1
