Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to increase the maximum size limit for core dump files as a regular user. Using bash, I can set it like this:

$ ulimit -c 100

which works well the first time I set it. However, the next time I use this command, I can only set this limit to a value not exceeding 100. In general, I can set it to an arbitrary value only the first time I use this command since login. All the next times, the possible values are limited from above by the initially set value.

How can I make this persistent across multiple uses of the command?

share|improve this question

1 Answer 1

Per @Peter Bašista's answer in his own question:

At first, I thought this is an error and that's why I started this question. But it turned out it's simply a perfectly correct behavior. It turns out that RTFM saying applies here as well.

As man bash reveals, the ulimit built-in command has additional parameters: -H for setting the so-called hard limits and -S for setting the so-called soft limits. Moreover, if none of these options are given, the default behavior is that ulimit tries to set both the soft and the hard limits to the same value at once. And that was the problem.

Now there is a quote from the bash man page:

A hard limit cannot be increased by a non-root user once it is set;

So, there we go. The correct usage of ulimit command should always have this in mind. Most importantly, it should never be used without -H or -S options unless you are sure to know what you are doing (which at the time I obviously wasn't).

What I should have done is something like this:

After login: ulimit -H -c unlimited

Each time I want to change maximum core dump size limit ulimit -S -c <new size>

So, that's about it. I hope it could help someone who might struggle with a similar problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.