1847631 Members
4116 Online
110265 Solutions
New Discussion

ulimit alterations

 
SOLVED
Go to solution
Brian Killeen_4
Occasional Advisor

ulimit alterations

Howdy all,

I have a development user that needs to regularly change the ulimit on a HPUX A-Class running HPUX 11.00 - The man pages refer to the fact that only the superuser can change the limits. Is there a way I can either allow a standard user to change their ulimits or alternatively can I as root change ulimits for a particular user.

Thanks in advance

Brian
8 REPLIES 8
Muthukumar_5
Honored Contributor

Re: ulimit alterations

We are having two ulimits as command line one and programming one.

ulimit(2) says as,
[EPERM] ulimit() fails and the limit is unchanged if a
process with an effective user ID other than
super-user attempts to increase its file size
limit.

You can use command line ulimit.
ulimit informations are given in ksh man page. Search the keyword as "ulimit"

You can try as like,

ulimit -Hn
-H - Hard limit
< -n for number of file descriptors >

ulimit -Sn
-S - soft limit

$ ulimit -Sn
10000
$ ulimit -Sn 15000
$ ulimit -Sn
15000

That is all. ulimit [-HSacdfst] [limit]

To set unlimited setup use as,
$ ulimit -Hc ulimited

Regards
Muthu
Easy to suggest when don't know about the problem!
Sundar_7
Honored Contributor

Re: ulimit alterations

Where did you read this from ? - even normal users can execute ulimit to change the limits.

ulimit is on a per-shell basis.

$ ulimit -l
$ ulimit -c 0

Learn What to do ,How to do and more importantly When to do ?
Brian Killeen_4
Occasional Advisor

Re: ulimit alterations

Thanks,

Sundar - If you type man ulimit this is where it mentions superuser although I believe as Muthukumar mentioned there are possibly two ulimits....

User at present types

$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 65536
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) 4194303
nofiles(descriptors) 4096

If he then trys to up the data limit he gets the following message.

$ ulimit -d 76800
su: ulimit: The specified value exceeds the user's allowable limit.

Perhaps there is a system maximum which needs to be set somewhere and this is what I need to change.

??

Brian

Ermin Borovac
Honored Contributor

Re: ulimit alterations

In order to increase ulimit data value you will need to modify maxdsiz kernel parameter, recompile kernel and reboot. It looks like maxdsiz on your system is currently set to 64M which is default.

data(kbytes) determined by maxdsiz
stack(kbytes) determined by maxssiz
nofiles(descriptors) determined by maxfiles
Muthukumar_5
Honored Contributor

Re: ulimit alterations

Your limit of data is only 65536 and you are trying to increase to 76800. so only it is prompting as, su: ulimit: The specified value exceeds the user's allowable limit.

If you want to configure with more values then you have to tune kernel parameters with kmtune ( < 11.23 versions ) and kctune ( >= 11.23 releases )

11.23>>

Parameters are maxfiles,maxfiles_lim,nfile,maxssiz,maxdsiz

kctune

or

kmtune -q


Recompilation needed when you tune on < 11.23 releases after tunin with kmtune

Regards
Muthu
Easy to suggest when don't know about the problem!
Brian Killeen_4
Occasional Advisor

Re: ulimit alterations

Thanks again for the help - Only got to try your suggestions today. I increased the maxdfiles to 81920 and the default for each shell has now increased accordingly - The problem now is that the user can reduce their ulimit but they cannot the increase it afterwards - They need to logout and generate a new shell to get back to the default.

Hmmmm

I thought that a user should be able to change the ulimit up or down to the system limit.

Any thoughts...?

I have below an example of the problem. This does not occur if logged in as root.


$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 81920
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) 4194303
nofiles(descriptors) 4096
$ ulimit -d 8000
$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 8000
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) 4194303
nofiles(descriptors) 4096
$ ulimit -d 64000
su: ulimit: The specified value exceeds the user's allowable limit.
Tom Danzig
Honored Contributor
Solution

Re: ulimit alterations

A hard limit cannot be increased once it is set. In other words, if you decrease it, you cannot subsequently increase it again. You can specify hard limit with -H and soft limit with -S. The soft limit, if decreased, can subsiquently be increased again (I think?) and can be increased up to the hard limit. The hard limit cannot.
Brian Killeen_4
Occasional Advisor

Re: ulimit alterations

Thanks to all for helping me on this one.

All replies helped.

I have now increased the maxdfiles kernel parameter which has increased the system default level and users are able to increase or decrease the limit within their shell using the

ulimit -S

option.

Cheers