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.

How To Set Ulimit Users and File Descriptions On Linux Server:

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.

Check Out: How To Mount the Same Volume To Multiple Container In Docker

We need to add these lines in /etc/sysctl.conf and run sysctl -p.

fs.file-max= 80000

We can check the default limits using cat /proc/sys/fs/ file-max

set ulimit in linux

The file-max is the maximum file descriptor. It’s a kernel setting enforced at the system level.

Check Out: How To Attach EBS Volume Without Reboot In AWS Cloud

In a similar way, you can check the default values for the root user.

ulimit -a

ulimit max user processes

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.

Check Out: How To Install Sentrifugo Open Source HR Management Tool On Linux

We can also check how many files are currently open using lsof | wc -l

linux process limits

Check how many file description is currently being used: more /proc/sys/fs/file-nr

 change ulimit in linux

Check the currently open file descriptor limit using the below commands.

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

linux process limits

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

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment