# Running under ansible - insufficient permission

**URL:** <https://forum.ansible.com/t/running-under-ansible-insufficient-permission/3020>\
**Category:** Get Help\
**Tags:** ssh, debian, ansible-core\
**Created:** [December 21, 2023, 9:40am UTC](https://forum.ansible.com/t/running-under-ansible-insufficient-permission/3020 "2023-12-21T09:40:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilia987](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ilia987/32/1852_2.png) [@ilia987](https://forum.ansible.com/u/ilia987)\
**Post date:** [December 21, 2023, 9:40am UTC](https://forum.ansible.com/t/running-under-ansible-insufficient-permission/3020/1 "2023-12-21T09:40:37Z")

</div>

i have some problems running specific code using ansible on remote:  
background:  
ubuntu22 with latest ansible\updates  
file /etc/security/limits.conf set with:

```auto
* soft core unlimited
* hard core unlimited

```

running the code directly on the host(without ansible) works

```auto
ssh target
sudo su my_user
python3

```

run code:

```auto
import resource
resource.getrlimit(resource.RLIMIT_CORE)
resource.setrlimit(
resource.RLIMIT_CORE,
(resource.RLIM_INFINITY, resource.RLIM_INFINITY)
)

```

but running the ansible code :

```auto
- name: python code
  shell:
    nohup run.py
  args:
  become: yes
  become_method: sudo
  become_user: my_user

```

**does not work** - the user don’t have permission to change ulimit

i was able to isolate the problem  
ansible login using the command  
**sudo -i -u my\_user /bin/bash**  
and the code does not working in this scenario,

but normal using **sudo su my\_user** it works

any idea how i can overcome it ?

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [December 21, 2023, 10:44am UTC](https://forum.ansible.com/t/running-under-ansible-insufficient-permission/3020/2 "2023-12-21T10:44:42Z")

</div>

> [@ilia987](#):
>
> ```yaml
> become_user: my_user
> 
> ```

Shouldn’t that be `root` in order to have permissions to change the ulimit? What permissions does `my_user` have?

---

<div class="post-metadata">

**Author:** ![ilia987](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ilia987/32/1852_2.png) [@ilia987](https://forum.ansible.com/u/ilia987)\
**Post date:** [December 21, 2023, 2:59pm UTC](https://forum.ansible.com/t/running-under-ansible-insufficient-permission/3020/3 "2023-12-21T14:59:31Z")

</div>

in general you are right,  
but setting the two lines:

```auto
* soft core unlimited
* hard core unlimited

```

in /etc/security/limits.conf give all users (\*) to set limits for any size
