0

I have some old code that needs the stack to not be limited to 8192kb in order for it to run. I am used to doing this in /etc/security/limits.conf

* stack   hard    unlimited
* stack   soft    unlimited

However in RHEL 7.9 having a local account with a bash shell when I do a ulimit -s it still responds with 8192. So my modification of limits.conf seems to have no affect?

In my terminal window having a bash shell if I do a ulimit -s unlimited first then run my code, my code runs fine.

What is the best way to set stack size to unlimited, globally for all users in RHEL 7.9 ?

Am I missing something, is ulimit and /etc/security/limits.conf not the same thing?

0
1

Using ulimit command to set limits will change the limits for the current spawned process (shell) and its children only.

For example if you do :

#With root
ulimit -s unlimited
#Switch to other user 
su - <user>
ulimit -s  ## unlimited ; because this still be a child process

But if you do :

  #With root
  ulimit -s unlimited
  #Logout
  logout
  #Login as the other user then execute the following
  ulimit -s ## 8192

Using /etc/security/limits.conf will set them permanently but you have to relogin ( New Session ) to they can be effective.

If even setting stack within /etc/security/limits.conf is not effective then check if it's been overridden under /etc/security/limits.d/ or look at your profile files ~/.bash_profile ~/.bashrc.

Also check if the above is available under /etc/pam.d/password-auth and /etc/pam.d/system-auth so you are sure that /etc/security/limits.conf is loaded :

session requires pam_limits.so
7
  • it's session required correct? – ron Dec 7 '20 at 19:40
  • yeah I have that under pam.d. A test pc running same exact rhel 7.9 setup, is fine with stack unlimited. But my server it seems like what I have in /etc/security/limit.conf is not being put into effect. I am stumped. – ron Dec 7 '20 at 19:44
  • I suppose I'll reboot the server when I can and see if that fixes it. I don't know what else to check at this point. – ron Dec 7 '20 at 19:45
  • Yes i don't see any other thing that can block this from working :) – Reda Salih Dec 7 '20 at 19:49
  • I think it might be systemd: unix.stackexchange.com/questions/345595/… – ron Dec 7 '20 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.