You are not logged in.

#1 2022-01-26 18:26:37

diogobaeder
Member
Registered: 2012-01-02
Posts: 60

[SOLVED] How to set ulimit at user level?

Hi folks,

I've got a problem here, which is, no matter what limit I set for open files, it does reflect for the root user, but doesn't reflect for my personal user.

Here's my settings for the limits file:

 $ grep nofile /etc/security/limits.conf
#        - nofile - max number of open file descriptors
*               soft    nofile          10000
*               hard    nofile          524288

And here's what I get as root:

 $ sudo bash -c 'ulimit -n'
10000

But here's what I get with my user itself:

 $ ulimit -n
1024

So I have a few questions:
1. Why is there a different setting being used for my user, if the configuration is applied to "*"?
2. Where can I permanently change my user's limit to the one used globally, or at least change it in a file specific for my user, without having to run "ulimit -n 10000" in my bashrc?

Thanks!

Last edited by diogobaeder (2022-01-27 13:06:39)

Offline

#2 2022-01-26 18:31:25

Daerandin
Member
From: Norway
Registered: 2013-05-07
Posts: 268
Website

Re: [SOLVED] How to set ulimit at user level?

Did you log out and in again after modifying the file? The current running session will not be affected.

Online

#3 2022-01-26 18:50:07

diogobaeder
Member
Registered: 2012-01-02
Posts: 60

Re: [SOLVED] How to set ulimit at user level?

Daerandin wrote:

Did you log out and in again after modifying the file? The current running session will not be affected.

Hi! Yes, I did, I've had those settings for more than a year now and have rebooted my computer a lot since then (I upgrade every week), so they should have been picked up. Maybe there's a program overriding that value?

Offline

#4 2022-01-26 21:01:18

dogknowsnx
Member
Registered: 2021-04-12
Posts: 652

Re: [SOLVED] How to set ulimit at user level?

Files in /etc/security/limits.d/ will override limits.conf...


RI - Rest your Eyes and Self

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#5 2022-01-26 21:12:20

seth
Member
Registered: 2012-09-03
Posts: 60,922

Offline

#6 2022-01-27 13:06:11

diogobaeder
Member
Registered: 2012-01-02
Posts: 60

Re: [SOLVED] How to set ulimit at user level?

Awesome stuff! Changing those systemd configurations did the trick for me, now I start with 10k max, as I wanted. Thanks!

It's a bit disappointing though that it overrides the normal /etc/security/limits.conf file settings, though; I think it's quite confusing. But anyway, it's solved now for me.

Thank you guys!

EDIT: Solution (thanks to the help above): https://unix.stackexchange.com/a/370652

Last edited by diogobaeder (2022-01-27 13:07:49)

Offline

Board footer

Powered by FluxBB