Super User is a question and answer site for computer enthusiasts and power users. 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

I am running ubuntu 13.04 and currently if any user accidently writes some code that uses too much RAM it brings the whole system down so badly I have to switch the power off and on again. Is there some way to configure users so that by default they are limited to using 4GB of RAM, say? Or is there another way to make the out of memory killer more aggressive than it currently is?

share|improve this question
Limit their memory with ulimit. – Zoredache Dec 12 '13 at 17:49
@Zoredache How do I limit a user or all users that way? What do I need to configure? – marshall Dec 12 '13 at 17:50 – Yitzchak Dec 12 '13 at 18:10
@Yitzchak Thanks but how do I configure users to have these limits? – marshall Dec 12 '13 at 18:15
up vote 4 down vote accepted

You can use ulimit to do this (not an expert but the manpage is generally helpful) or edit the configuration file directly.
Create a limits file at etc/security/limits.conf which should allow you to set a user limit like this:

username hard as some_number_in_kilobytes

The only part that really needs explanation is "hard". Users can set their own limits but according to TFM those are "soft" limits which can only be set up to the hard limit. Hopefully your users can't sudo to root.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .