Score:0

CentOS: ulimit hard/soft limits keep reset to default values

um flag

On CentOS7 I am trying to change the values of ulimit as following:

ulimit -Hn 262144
ulimit -Sn 100000

But the value is being reset to its default values just after signing out:

[root@server001]# ulimit -Hn
4096
[root@server001]# ulimit -Sn
1024

Am I setting the values permanently this way? if not, how to do it?

And if it is permanent, why it is coming back to its default value?

Score:1
cn flag

If you set limits with the ulimit command, your changes will remain effective only until log out or reboot. It's the observed behavior.

To change limits permanently you have to edit /etc/security/limits.conf.

Here is how to set the values for soft and hard number of open files for everyone (*).

*               soft    nofile          100000
*               hard    nofile          262144

For the changes to take effect you need to log out and re-login.

More info in the man page

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.