Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
@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
    
ss64.com/bash/ulimit.html –  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

1 Answer 1

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

Your Answer

 
discard

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.