Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to change the: - soft limit and - hard limit of a SPECIFIC process? In my case, my process is mongod and a lot of web resources tell me to simply write: ulimit -n in my Terminal.

But how will the terminal know that I want to modify only the limits for the mongod process? Do I need to write the command somewhere in particular?

Also, once the above question is solved, is it possible to increase the hard limit since I am assuming that the above command works for the soft limit only.

Thank you very much!

share|improve this question
up vote 1 down vote accepted

What they try to tell is that you should first execute ulimit and then run mongod on the same shell session. This way Mongo DB process will have it's limits changed.

As you probably want to start Mongo DB using the startup script, the simplest solution would be modify this startup script and add ulimit call before starting Mongo DB daemon. This is still not the best solution to modify Mongo DB startup scripts.

The best way to deal with this problem would be changing limit defaults in file /etc/security/limits.conf or better adding specific configuration to /etc/security/limits.d See man pam_limits and man limits.conf for more information.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.