I am migrating one of our servers from centos 7 to ubutnu 22.4 lts
Found an interesting issue:
set /etc/security/limits.conf is set set with:
* soft core unlimited
* hard core unlimited
created new user named AAA,
code i am trying to run inside python3 shell (as AAA):
import resource
resource.getrlimit(resource.RLIMIT_CORE)
resource.setrlimit(
resource.RLIMIT_CORE,
(resource.RLIM_INFINITY, resource.RLIM_INFINITY)
)
when login to the user using the command: sudo su AAA the code works and i can set core dump to unlimited
when login to the user with: sudo -i -u AAA /bin/bash
the python code fails, user dont have permission
I am editing it because it tagged as duplication. reason why it is not: Setting the security settings in limits.conf, both method (sudo su and sudo -i -u should give the same result)