LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-17-2011, 12:21 PM   #1
kshazad86
LQ Newbie
 
Registered: Apr 2011
Posts: 5

Rep: Reputation: 0
How to stop someone eating all the memory?


If I have a centos linux server, how can I stop a user on the server from eating all the memory and swap space memory, maybe due to a poorly written script, infinite loop etc?
 
Old 04-17-2011, 01:26 PM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
I'd enforce file system quota's...

maybe this will help:
http://www.yolinux.com/TUTORIALS/Lin...ialQuotas.html

Luck!

Thor
 
Old 04-17-2011, 01:29 PM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,226

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
/etc/security/limits give you some controls over user processes.

You can set a per-process max VM size, which should do what you want.

See the man page for setrlimit for a description of what the various limits control.
 
1 members found this post helpful.
Old 04-17-2011, 01:33 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
I will second the pam_limits recommendation (although you're going to want to do some reading to supplement setrlimit(2)). Please see the manpages for pam_limits(8) and limits.conf(5).
 
Old 04-17-2011, 02:29 PM   #5
kshazad86
LQ Newbie
 
Registered: Apr 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for replying...

I have noticed I can set the memory limit per process in /etc/profile

Quote:
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
I have two questions:

1.) Will changes to this file affect every user on the server?
2.) What would be a good limit to place on "max memory size" and "virtual memory" and should they be the same?

Note: My system currently has 8GB of RAM.

Last edited by kshazad86; 04-17-2011 at 02:31 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Something is eating my memory davidstvz Linux - Server 14 11-27-2009 11:21 AM
eating all my memory (HELP!) twon Linux - Hardware 4 05-12-2006 09:40 AM
Something is eating my memory benne Linux - Software 15 11-25-2004 07:02 AM
Linux is eating to much memory!!! alwin Linux - General 9 01-13-2003 05:50 PM
How do I see what's eating all my memory? thomas.nichols Linux - General 1 09-05-2001 10:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration