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?

  • 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
    Jun 21, 2017 at 6:29

1 Answer 1


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.

  • 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
    Jun 21, 2017 at 7:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .