Operating System - HP-UX
1825775 Members
2263 Online
109687 Solutions
New Discussion

limits on stack/file size for user

 
Jayesh shah
Frequent Advisor

limits on stack/file size for user

Hi,

Is there any way on hpux to set the limit on
1. FILE size
2. DATA segment
3. STACK size
4. Core file size
5. CPU time

on a user basis. For example, can it be ensured that any process launched by a specific user does not consume certain stack or data segment size.

Regards
Jayesh
16 REPLIES 16
V.Tamilvanan
Honored Contributor

Re: limits on stack/file size for user

Hi,
See ulimit.
Robert-Jan Goossens
Honored Contributor

Re: limits on stack/file size for user

Hi Jayesh,

Check the command

# ulimit -a

# man ulimit
for more.

Hope this helps,
Robert-Jan
Mark Grant
Honored Contributor

Re: limits on stack/file size for user

All this information is available using "ulimit" try looking at "ulimit -a". You can set them using ulimit as well. Check the man page "man sh-posix" and look for the section on ulimit.
Never preceed any demonstration with anything more predictive than "watch this"
Jayesh shah
Frequent Advisor

Re: limits on stack/file size for user

Hi All,

What I need is not a global setting that applies for all users. But the ability to set individual limits based on the user.

ulimit does not provide the answer to my question. Please let me know if I am unclear in my explanation.

Regards
Jayesh
Fabio Ettore
Honored Contributor

Re: limits on stack/file size for user

Hi Jayesh,

as already said ulimit is the right command (man ulimit).
In order to fix changes, you should set ulimit commands in user' .profile.

An useful doc about it:
KBRC00013375 - What happens when a program core file exceeds file system space?

It contains other docs ID, for example:
UNX1000203 - Can you limit the size of a core file on 10.X?

I hope this helps you.

Best regards,
Ettore
WISH? IMPROVEMENT!
Robert-Jan Goossens
Honored Contributor

Re: limits on stack/file size for user

Hi,

No you are very clear, use ulimit in the /etc/profile (global).

Robert-Jan
Fabio Ettore
Honored Contributor

Re: limits on stack/file size for user

Hi,

I apologize because I don't want to contradict a Royalty...
Just attention: in order to fix ulimit command for an user, it should be inserted in .profile of that user.
In doc UNX1000203 that I have already indicated:

*****************************
If you always want this behavior, put this command in your personal shell
initialization file. (The /etc/profile file is a bad choice for this
command, since it gets read by other shells that do not understand
`ulimit -c').
*****************************

Best regards,
Ettore
WISH? IMPROVEMENT!
Robert-Jan Goossens
Honored Contributor

Re: limits on stack/file size for user

Hi Jayesh,

Please feel free to contradict me (:-).

What kind of shells do your users use ?

Kind regards,
Robert-Jan
Gary Yu
Super Advisor

Re: limits on stack/file size for user

Hi,

Just want to add a little reminder, some ulimit settings also depend on kernel parameters, e.g "ulimit -d" can not exceed maxdsiz or maxdsiz_64bit

thanks,
Gary
Umapathy S
Honored Contributor

Re: limits on stack/file size for user

Jayesh,
To add more, sh-posix is the default shell in hpux. You can modify the ulimit in a posix shell only. ksh doesnt support in modifying those values. This is most suitable for specifying different limits for different users.

Kernel parameters are more global.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Jayesh shah
Frequent Advisor

Re: limits on stack/file size for user

Hi,

Setting limits in .profile is not a solution as they can be overriden and not always effective. What I was looking is some way of per user kernel parameter or some other per user setting independent of the shell.

Is setting of this feature available in better way on other operating systems (other than hpux).

Regards
Jayesh
Fabio Ettore
Honored Contributor

Re: limits on stack/file size for user

Hi,

on Linux systems there is a possibility:
/etc/security/limits.conf file contains ulimit settings about users but on HP-UX this file and feature don't exist and the only one possibility is ulimit in .profile.
Anyway really and gladly I will wait replies that deny my statement.

Best regards,
Ettore

WISH? IMPROVEMENT!
Jayesh shah
Frequent Advisor

Re: limits on stack/file size for user

Hi Ettore,

Thanks for your reply. I will look into the limits.conf file. Can you please let me know the format for this file?

I too gladly wait replies that deny your statement that this feature is unavailable on hpux.

Regards
Jayesh
Vitaly Karasik_1
Honored Contributor

Re: limits on stack/file size for user

in fact, limits.conf (pam_limits.so) is part of PAM system.

Probably you can add this module to HPUX (AFAIK, HPUX 11.xx supports PAM)

Regards,
Vitaly.

See See /usr/share/doc/pam-version/txts/README.pam_limits for more.
(on linux, of course)
Fabio Ettore
Honored Contributor

Re: limits on stack/file size for user

Hi Jayesh,

/etc/security/limits.conf file sees as follows:

# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#
#
#Where:
# can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
# can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
# can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
#
#
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4

# End of file



Anyway it is on Linux systems. As far as I know there isn't the same feature on HP-UX O.S., even with PAM integration.

Best regards,
Ettore
WISH? IMPROVEMENT!
Vitaly Karasik_1
Honored Contributor

Re: limits on stack/file size for user

Why PAM so usable and flexible? - because we can add/combine PAM modules in order to provide new features.

HPUX 11 is PAM-aware OS.

So even if there is no limits PAM module for HPUX, it's possible to port Linux module or write by yourself.

http://www.us.kernel.org/pub/linux/libs/pam/index.html may help you

Regards,
Vitaly