determine ulimit for root user

Posted on

determine ulimit for root user – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, solr, ulimit, , .

we believe we have increased the max open file descriptors for the root user. This was done by adding this line to /etc/security/limits.conf:

*         -    nofile            2048

We think we’ve confirmed that the root user’s limit was increased because we can tell (not described here) that our application (solr – which is run by root) has 1098 files open. However, we can’t tell for sure how many open files the root user is allowed. We would expect this command to work, but it doesn’t seem to be:

$ sudo -u root -s "ulimit -Sn"

Any ideas? Thanks!

Solution :

Get the PID of the process that solr is running and then cat /proc/$SOLR_PID/limits — this will tell you the actual limits of the process.

I’d recommend to run things like solr as a seperated unprivileged user. When doing this you have multiple options (limits.conf or add a ulimit -n 2048 to the init script, …). The last one isn’t all that shiny but works for quick settings and restarting the daemon

RANT: don’t tell me you can’t restart becauso you’ll lose service. If that is the case you should have a HA setup anyway 🙂

After changing number of open files in /etc/security/limits.conf, user must log out and log back in to take effect. So, try this:

$ sudo su -
# ulimit -Sn

I know this question has an answer, but that looks more like a work around, not a real solution.

According to ubuntu this is not a bug but a documentation issue, see:

Thanks for your report. As you said this is not a bug in pam but a documentation issue.
The fact to allow explicitly allow limits for user root has been addressed a while ago (30 Aug 2000) but you need to explicitly name user root to apply the limits.

So if you want to change the ulimit on all users, including the root user you have to specify:

*         -    nofile            2048
root      -    nofile            2048

Leave a Reply

Your email address will not be published.