Consequences of setting max open file descriptors to “unlimited” and how?

0

Is it possible to permanently set max open file descriptors to unlimited (or something like 1 000 000 000 /or even higher)?

If yes, please tell me how. I tried ulimit -n 1048576 and it's working, but after logout this option was set to default 1024.

Are there any security issues or can be something damaged using unlimited file descriptors for process?

Rossko_DCA

Posted 2017-06-21T06:17:15.900

Reputation: 3

See here for soft, hard and kernel limits. The file descriptors are a table in memory of a certain size, and unless you have infinitive memory, you can't set it to unlimited. And the higher you set it, the more kernel address space it will take.

– dirkt – 2017-06-21T06:29:28.003

Answers

2

You can set permanently different limits in /etc/security/limits.conf. The expected format is (for file handlers):

<user>          soft    nofile            <value>
<user>          hard    nofile            <value>

This will work after you next login. Also you can add .conf file in /etc/security/limits.d with the same format

Also is possible to set for particular user in .bashrc file like this:

ulimit -n <value>

But as mentioned in comment those limits must not be set to very high value as they will eat your memory.

Romeo Ninov

Posted 2017-06-21T06:17:15.900

Reputation: 2 062

thank you, I have had it right that way, but thought * mean "everyone". I changed it to root and it's working now – Rossko_DCA – 2017-06-21T07:31:00.687