Currently ulimit -n
shows 10000
. I want to increase it to 40000
. I've edited "/etc/sysctl.conf" and put fs.file-max=40000
. I've also edited /etc/security/limits.conf
and updated hard and soft values. But still ulimit shows 10000
. After making all these changes I rebooted my laptop. I've access to root password.
usr_name@usr_name-lap:/etc$ /sbin/sysctl fs.file-max
fs.file-max = 500000
Added following lines in /etc/security/limits.conf
-
* soft nofile 40000
* hard nofile 40000
I also added following line in /etc/pam.d/su
-
session required pam_limits.so
I've tried every possible way as given on other forums, but I can reach up to a maximum limit of 10000
, not beyond that. What can be the issue?
I'm making this change because neo4j
throws maximum open file limits reached error.
I did it like this
tl;dr set both the soft and hard limits
I'm sure it's working as intended but I'll add it here just in case. For completeness the limit is set here (see below for syntax): /etc/security/limits.conf
and activated with the following in /etc/pam.d/common-session:
If you set only the hard limit,
ulimit -a
will show the default (1024): If you set only the soft the limit ulimit -a will show (4096)If you set them both
ulimit -a
will show the soft limit (up to the hard limit of course)Try run this command it will create a
*_limits.conf
file under/etc/security/limits.d
Just exit from terminal and login again and verify by
ulimit -n
it will set for * usersI have lots of trouble getting this to work.
Using the following allows you to update it regardless of your user permission.
sudo sysctl -w fs.inotify.max_user_watches=100000
Edit
Just saw this from another user also on another stackexchange site (both work, but this version permanently updates the system setting, rather than temporarily):
I was having the same issue, and got it to work by adding entries to
/etc/security/limits.d/90-somefile.conf
. Note that in order to see the limits working, I had to log out completely from the ssh session, and then log back in.I wanted to set the limit for a specific user that runs a service, but it seems that I was getting the limit that was set for the user I was logging in as. Here's an example to show how the ulimit is set based on authenticated user, and not the effective user:
You can use an
*
to specify an increase for all users. If I restart the service as the user I logged in, and addulimit -n
to the init script, I see that the initial login user's limits are in place. I have not had a chance to verify which user's limits are used during a system boot or of determining what the actual nofile limit is of the service I am running (which is started with start-stop-daemon).There's 2 approaches that are working for now:
ULIMIT configuration:
Make Below entry
Ulimit configuration start for website user
Make Below entry for ALL USER
Ulimit configuration for every user
After modifying the file, user need to logoff and login again to see the new values.