ulimit TOTAL memory can be used per user?

ulimit TOTAL memory can be used per user?

Post by Paul T Wan » Mon, 03 Sep 2001 02:33:32



ulimit TOTAL memory can be used per user?

Is there a way to ulimit the total memory allowed by one user ?

--

- paultwang -
PGP: 0x2670EA0E

 
 
 

ulimit TOTAL memory can be used per user?

Post by Andy Hibbin » Mon, 03 Sep 2001 02:54:04



> ulimit TOTAL memory can be used per user?

> Is there a way to ulimit the total memory allowed by one user ?

> --

> - paultwang -
> PGP: 0x2670EA0E

Hi,
Have you tried looking at the limits.conf file located in /etc/security? it
allows you to define limits for the number of processes, locked in memory,
open files etc.

Andy H
--------------------------
Happy 10th Birthday Linux

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Mon, 03 Sep 2001 03:19:19




> > ulimit TOTAL memory can be used per user?

> > Is there a way to ulimit the total memory allowed by one user ?
>  Have you tried looking at the limits.conf file located in /etc/security? it
>  allows you to define limits for the number of processes, locked in memory,
>  open files etc.

What is the difference to ulimit? The settings are exactly the same.
Or did I miss something?

--
2.4.5 in init/main.c(607):
  struct task_struct *child_reaper = &init_task;

 
 
 

ulimit TOTAL memory can be used per user?

Post by Michael Heimin » Mon, 03 Sep 2001 04:11:31


Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like only he
can:



>> > ulimit TOTAL memory can be used per user?

>> > Is there a way to ulimit the total memory allowed by one user ?

>>  Have you tried looking at the limits.conf file located in
>>  /etc/security? it allows you to define limits for the number of
>>  processes, locked in memory, open files etc.

> What is the difference to ulimit? The settings are exactly the same.
> Or did I miss something?

Somehow the same, ulimit is a bash builtin, /etc/security/limits.conf
belongs to PAM. "The Linux-PAM System Administrators'
Guide" (linuxdoc.org), case it didn't came with your distro, for more
info.

Michael Heiming

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Mon, 03 Sep 2001 04:39:53



>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like only he
>  can:
> > What is the difference to ulimit? The settings are exactly the same.
> > Or did I miss something?

>  Somehow the same, ulimit is a bash builtin, /etc/security/limits.conf
>  belongs to PAM. "The Linux-PAM System Administrators'
>  Guide" (linuxdoc.org), case it didn't came with your distro, for more
>  info.

I mean, do the same problems appear (vmsize is only a limit
for a single process and not all together)?

--
2.4.5 in kernel/acct.c(25):
  XTerms and EMACS are manifestations of pure evil.

 
 
 

ulimit TOTAL memory can be used per user?

Post by Michael Heimin » Mon, 03 Sep 2001 05:03:15


Rudolf Polzer wrote at Saturday 01 September 2001 21:39 like only he
can:


>>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like only
>>  he can:
>> > What is the difference to ulimit? The settings are exactly the
>> > same. Or did I miss something?

>>  Somehow the same, ulimit is a bash builtin,
>>  /etc/security/limits.conf belongs to PAM. "The Linux-PAM System
>>  Administrators' Guide" (linuxdoc.org), case it didn't came with
>>  your distro, for more info.

> I mean, do the same problems appear (vmsize is only a limit
> for a single process and not all together)?

You can set the values to your needs, combining them, settings per
user are possible.
I fail to see your problem?

Michael Heiming

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Mon, 03 Sep 2001 06:04:20



>  Rudolf Polzer wrote at Saturday 01 September 2001 21:39 like only he
>  can:


> >>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like only
> >>  he can:
> >> > What is the difference to ulimit? The settings are exactly the
> >> > same. Or did I miss something?

> >>  Somehow the same, ulimit is a bash builtin,
> >>  /etc/security/limits.conf belongs to PAM. "The Linux-PAM System
> >>  Administrators' Guide" (linuxdoc.org), case it didn't came with
> >>  your distro, for more info.

> > I mean, do the same problems appear (vmsize is only a limit
> > for a single process and not all together)?

>  You can set the values to your needs, combining them, settings per
>  user are possible.
>  I fail to see your problem?

I mean: when I do a
  ulimit -v 8192
I can still use up more than 8M by just using multiple processes.

I wanted to know if /etc/security/limits.conf has the same problem.
At least the possible settings are the same, so I guess (do not
know) that /etc/security/limits.conf just calls ulimit() to
do its work.

--
2.4.5 in Documentation/MAINTAINERS:
  THE REST
  P:      Linus Torvalds
  S:      Buried alive in reporters

 
 
 

ulimit TOTAL memory can be used per user?

Post by Michael Heimin » Mon, 03 Sep 2001 16:30:16


Rudolf Polzer wrote at Saturday 01 September 2001 23:04 like only he
can:


>>  Rudolf Polzer wrote at Saturday 01 September 2001 21:39 like only
>>  he can:


>> >>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like
>> >>  only he can:
>> >> > What is the difference to ulimit? The settings are exactly the
>> >> > same. Or did I miss something?

>> >>  Somehow the same, ulimit is a bash builtin,
>> >>  /etc/security/limits.conf belongs to PAM. "The Linux-PAM System
>> >>  Administrators' Guide" (linuxdoc.org), case it didn't came with
>> >>  your distro, for more info.

>> > I mean, do the same problems appear (vmsize is only a limit
>> > for a single process and not all together)?

>>  You can set the values to your needs, combining them, settings per
>>  user are possible.
>>  I fail to see your problem?

> I mean: when I do a
>   ulimit -v 8192
> I can still use up more than 8M by just using multiple processes.

True, but you may limit the number of process too.

Quote:> I wanted to know if /etc/security/limits.conf has the same problem.
> At least the possible settings are the same, so I guess (do not
> know) that /etc/security/limits.conf just calls ulimit() to
> do its work.

No, PAM is working through the kernel, where ulimit is used by bash,
other shells may require another setup, as /etc/profile may not be
read by them (Ie. csh), so using PAM would enable more global
settings.

Michael Heiming

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Mon, 03 Sep 2001 17:01:53



>  Rudolf Polzer wrote at Saturday 01 September 2001 23:04 like only he
>  can:


> >>  Rudolf Polzer wrote at Saturday 01 September 2001 21:39 like only
> >>  he can:


> >> >>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like
> >> >>  only he can:
> >> >> > What is the difference to ulimit? The settings are exactly the
> >> >> > same. Or did I miss something?

> >> >>  Somehow the same, ulimit is a bash builtin,
> >> >>  /etc/security/limits.conf belongs to PAM. "The Linux-PAM System
> >> >>  Administrators' Guide" (linuxdoc.org), case it didn't came with
> >> >>  your distro, for more info.

> >> > I mean, do the same problems appear (vmsize is only a limit
> >> > for a single process and not all together)?

> >>  You can set the values to your needs, combining them, settings per
> >>  user are possible.
> >>  I fail to see your problem?

> > I mean: when I do a
> >   ulimit -v 8192
> > I can still use up more than 8M by just using multiple processes.

>  True, but you may limit the number of process too.

So if I want a user to only use up 64 MB and have 32 processes (not
very much, especially in X), any process only may have 2 MB? No, that
is not feasible.

Quote:> > I wanted to know if /etc/security/limits.conf has the same problem.
> > At least the possible settings are the same, so I guess (do not
> > know) that /etc/security/limits.conf just calls ulimit() to
> > do its work.

>  No, PAM is working through the kernel, where ulimit is used by bash,
>  other shells may require another setup, as /etc/profile may not be
>  read by them (Ie. csh), so using PAM would enable more global
>  settings.

I mean: do both call the ulimit() function? If yes, they must have
the same drawbacks.

--
www42:~ # mv /mnt/c/windows/win.com /dev/null
mv: /dev/null: data refused

 
 
 

ulimit TOTAL memory can be used per user?

Post by Michael Heimin » Mon, 03 Sep 2001 19:41:51


Rudolf Polzer wrote at Sunday 02 September 2001 10:01 like only he
can:


>>  Rudolf Polzer wrote at Saturday 01 September 2001 23:04 like only
>>  he can:


>> >>  Rudolf Polzer wrote at Saturday 01 September 2001 21:39 like
>> >>  only he can:


>> >> >>  Rudolf Polzer wrote at Saturday 01 September 2001 20:19 like
>> >> >>  only he can:
>> >> >> > What is the difference to ulimit? The settings are exactly
>> >> >> > the same. Or did I miss something?

>> >> >>  Somehow the same, ulimit is a bash builtin,
>> >> >>  /etc/security/limits.conf belongs to PAM. "The Linux-PAM
>> >> >>  System Administrators' Guide" (linuxdoc.org), case it didn't
>> >> >>  came with your distro, for more info.

>> >> > I mean, do the same problems appear (vmsize is only a limit
>> >> > for a single process and not all together)?

>> >>  You can set the values to your needs, combining them, settings
>> >>  per user are possible.
>> >>  I fail to see your problem?

>> > I mean: when I do a
>> >   ulimit -v 8192
>> > I can still use up more than 8M by just using multiple processes.

>>  True, but you may limit the number of process too.

> So if I want a user to only use up 64 MB and have 32 processes (not
> very much, especially in X), any process only may have 2 MB? No,
> that is not feasible.

>> > I wanted to know if /etc/security/limits.conf has the same
>> > problem. At least the possible settings are the same, so I guess
>> > (do not know) that /etc/security/limits.conf just calls ulimit()
>> > to do its work.

>>  No, PAM is working through the kernel, where ulimit is used by
>>  bash, other shells may require another setup, as /etc/profile may
>>  not be read by them (Ie. csh), so using PAM would enable more
>>  global settings.

> I mean: do both call the ulimit() function? If yes, they must have
> the same drawbacks.

No, they don't as I wrote before.

Using something like this, should do what you want:

username     hard  nproc   32
username     hard  rss     64000

http://www.kernel.org/pub/linux/libs/pam/index.html for more info.

Michael Heiming

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Mon, 03 Sep 2001 19:46:25



>  Rudolf Polzer wrote at Sunday 02 September 2001 10:01 like only he
>  can:
> > I mean: do both call the ulimit() function? If yes, they must have
> > the same drawbacks.

>  No, they don't as I wrote before.

>  Using something like this, should do what you want:

>  username     hard  nproc   32
>  username     hard  rss     64000

At least it does not work. I have now:

rpolzer         hard    as      8192
rpolzer         hard    rss     8192
rpolzer         hard    data    8192
rpolzer         hard    stack   8192

but this still works:



Perhaps I first need to 'switch on' this limiter? I have Debian 2.2r3
Potato.

Or when do these changes become active? After reboot? I only tried
relogin.

--
Your password must be at least 18770 characters and cannot repeat any of
your previous 30689 passwords. Please type a different password. Type a
password that meets these requirements in both text boxes. [M$]
(Fix: http://support.microsoft.com/support/kb/articles/q276/3/04.ASP)

 
 
 

ulimit TOTAL memory can be used per user?

Post by Michael Heimin » Tue, 04 Sep 2001 00:19:57


Rudolf Polzer wrote at Sunday 02 September 2001 12:46 like only he
can:


>>  Rudolf Polzer wrote at Sunday 02 September 2001 10:01 like only he
>>  can:
>> > I mean: do both call the ulimit() function? If yes, they must
>> > have the same drawbacks.

>>  No, they don't as I wrote before.

>>  Using something like this, should do what you want:

>>  username     hard  nproc   32
>>  username     hard  rss     64000

> At least it does not work. I have now:

> rpolzer         hard    as      8192
> rpolzer         hard    rss     8192
> rpolzer         hard    data    8192
> rpolzer         hard    stack   8192

> but this still works:



> Perhaps I first need to 'switch on' this limiter? I have Debian
> 2.2r3 Potato.

> Or when do these changes become active? After reboot? I only tried
> relogin.

Hello,

this a newsgroup, not a help desk, did you even bother to check the
docs I suggested to read, where it says somewhere concerning the
pam_limits module:

Module Name:

     pam_limits
[...]
System dependencies:

     requires an /etc/security/limits.conf file and kernel support    
     for resource limits. Also uses the library, libpwdb.

Good luck

Michael Heiming

 
 
 

ulimit TOTAL memory can be used per user?

Post by Rudolf Polze » Tue, 04 Sep 2001 00:48:24



>  Rudolf Polzer wrote at Sunday 02 September 2001 12:46 like only he
>  can:
> > Perhaps I first need to 'switch on' this limiter? I have Debian
> > 2.2r3 Potato.

> > Or when do these changes become active? After reboot? I only tried
> > relogin.

>  Hello,

>  this a newsgroup, not a help desk, did you even bother to check the
>  docs I suggested to read, where it says somewhere concerning the
>  pam_limits module:

I did.

Quote:>  Module Name:

>       pam_limits
>  [...]
>  System dependencies:

>       requires an /etc/security/limits.conf file and kernel support    
>       for resource limits. Also uses the library, libpwdb.

This was definitively _not_ the problem. It was /etc/pam.d/login
- the limits line was commented out. I just thought "Debian did
of course do this correctly" - and this seems like a bug in the
distribution.

--

{if($c=$s[$x][$y]=1-$s[$x][$y]){($a,$b)=(-$b,$a);}else{($a,$b)=($b,-$a)

Quote:}$d=$s[$x][$y^1]*(1+($y&1))+(2-($y&1))*$c;print"\e[".int($y/2).";${x}H"

.(substr(' .:',$d,1));$x+=$a;$y+=$b;for(1..1000){};}print"\e[HDone.\n"
 
 
 

ulimit TOTAL memory can be used per user?

Post by Nick Craig-Wo » Thu, 06 Sep 2001 18:47:00



> I mean: when I do a
>   ulimit -v 8192
> I can still use up more than 8M by just using multiple processes.

What you want is per-user accounting not per process accounting.  This
is a long standing feature request / flamewar on the linux kernel
mailing list...

There are some patches to do per-user CPU accounting & resource
limiting (the fairsched patch by Rik van Riel and the unrelated
fairsched.sf.net) which stops one user using up all the CPU unfairly
but I haven't seen one for memory.

--
Nick Craig-Wood