How to Set Unlimited Users and File descriptions on Linux server

Linux has a unique system for installing and changing the maximum number of user processes, uilimit. The default number of file descriptors that any process can open is 1024 per process.

Installing unlimited users and descriptions on the server

When you do this task, you get the error “too many files open limit”. This means that there is a limitation on opening Linux files according to the user’s session. To do this, add a line to /etc/sysctl.conf and run sysctl -p:

fs.file-max = 80000

Next, we check the default constraints. This can be done with the following command:

cat /proc/sys/fs/ file-max

file-max is the maximum file descriptor. This is a kernel setting applied at the system level. Also you can check the default values ​​for the root user.

ulimit -a

It is also possible to set hard and soft limits by editing this vim file /etc/security/limits.conf

* hard nofile 600000
* soft nofile 600000

Set hard and soft limits for Linux user

linux hard nofile 600000
linux soft nofile 600000

Then run the following command to make the changes

sysctl -p

It is also possible to check how many files are open at the moment using following command

lsof | wc -l

You can check how many file descriptions are currently in use with the following command:

more /proc/sys/fs/file-nr

Check the file descriptor limit for the currently open file using the following commands

more /proc/sys/fs/file-max
sysctl -a | grep fs.file-max

After making the changes, you need to log out and log back in.

Was this article helpful?

Related Articles

Leave A Comment?