How To Set Ulimit Users and File Descriptions On Linux Server
We can set and change ulimit max user process limits in Linux. The default number of file descriptors that any process can open 1024 per process.
If you get “too many files open limit” error in Linux server because there’s a limit to open the files In Linux as per user session.
We need to add these lines in /etc/sysctl.conf and run sysctl -p.
We can check the default limits using cat /proc/sys/fs/ file-max
The file-max is the maximum file descriptor. It’s a kernel setting enforced at the system level.
In a similar way, you can check the default values for the root user.
We can also set a hard limit and soft limits by editing these file vim /etc/security/limits.conf
* hard nofile 600000 * soft nofile 600000
Hard and Soft limit set for user ‘Linux’
linux hard nofile 600000 linux soft nofile 600000
Then run the sysctl -p to make changes.
We can also set the limit of the process for the root user to be unlimited with ulimit -u unlimited and save these lines in /root/.bashrc for permanent.
We can also check how many files are currently open using lsof | wc -l
Check how many file description is currently being used: more /proc/sys/fs/file-nr
Check the currently open file descriptor limit using the below commands.
more /proc/sys/fs/file-max sysctl -a | grep fs.file-max
After making changes, you need to logout and login to the machine again. There’re lots of options available and you may check here on the official page of RedHat.
You’re done set ulimit in linux linux process limits change processes max user