Yes there is a way to do this. The way I have it working is kind of a
hack because I could never get the real way to work. Try 'man 5 limits'
to find the real way to work it. It involves a file called /etc/limits
and limit strings for users and groups, but the way I have it working is
a little different. This is a chunk from my /etc/profile...
if [ "`id $USER | grep '80(unrestricted)'`" = "" ]; then
if [ "`id -u`" -gt "999" ]; then
if [ "$SHELL" = "/bin/bash" ]; then
ulimit -Sc 0 # core size 0
ulimit -Hc 0
ulimit -Sd 16384 # data segment size 16 meg
ulimit -Hd 16384
ulimit -Sm 16384 # resident mem size 16 meg
ulimit -Hm 16384
ulimit -Su 10 # 10 max processes
ulimit -Hu 10
fi
if [ "$SHELL" = /bin/ksh ]; then # the user uses ksh
ulimit -c 0 # core size
ulimit -d 16384 # data seg size 16 meg
ulimit -m 16384 # real mem useage 16 meg
ulimit -l 16384 # locked mem usage 16 meg
ulimit -p 10 # 10 max processes
fi
echo "User restrictions applied."
fi
fi
Basically it sets limits in the shell for anybody with a uid greater than
999 (my normal userid's start at 1000) and anybody not in group
80(unrestricted). Since both ksh and bash use this profile, then the
limits will get set. There is also a similar chunk for csh and tcsh in
the /etc/csh.cshrc file for those shells. Then my /etc/shells contains
only those four shells. This isn't the best way to do it because there is
probably a way around it, but it keeps the script kiddies from using the
popular...
while(1) { int c; c = malloc(1000); fork() }
to crash my machine.
-CJO-
On Wed, 20 Jan 1999, Trevor Reynolds wrote:
>Hi, is there a way that one could limit how much cpu/ram a users process
>consumes. I've read somewhere that this could be done, but I could not find
>any information on exactly how to do it. Also on another subject, is there a
>better (less system intensive) cron system other than the one that comes
>with Slackware, as there are about 70-80 different cron jobs running on this
>one system, and every so often, all the cron jobs start forking. Thanks in
>advance.
>
>Trevor Reynolds
>
C.J. Oster (Linux Guru/Surge Addict)
------------------------------------------------------------------
| [EMAIL PROTECTED] | 910 S. 3rd St, #1218 | CCSO, WSG, UIUC |
| [EMAIL PROTECTED] | Champaign, IL 61820 | 1443 DCL, Urbana |
------------------------------------------------------------------
(580)761-6393 (217)328-8934
"Linux, for people with an IQ above 98" - Bumper Sticker
"Hm, a little big for a cup holder... Why does it say '4x' on it?"