The meaning of ulimit Hard (-H) and Soft (-S)

What does Hard / Soft mean?

The difference in the size of the main file, for example:
ulimit -Sc 1024 compared to ulimit -Hc 1024

I usually run my ulimit -c unlimited script before running the binary.
However, I want to limit the file size to avoid full disk space.
And then I wonder how best:

 ulimit -Sc 1024 # Soft ulimit -Hc 1024 # Hard ulimit -c 1024 # Both 

One more tip: how about value? ulimit -c 1024 or ulimit -c 10240 or something else?

+7
source share
1 answer

Severe restrictions are usually set by the system administrator to the highest value that would be convenient for them when using multiple users.

By default, system administrators set minimum limits on the values ​​that they would like to use in most cases. (Consider soft_limit * number_of_users == almost the entire available resource. Leave enough for root to clear everything that needs to be done, and users who can tinker with hard restrictions to push borders a little. Absolute stability will give hard restrictions very close to soft limits.)

If this is your first time care, I would just set soft limits. This gives you the opportunity to completely or completely remove them in the same session, without requiring you to kill this terminal and all its children.

I believe the kernel size limit is in bytes, so 1024 and 10240 too small for everyone but the most stupid programs . I would start with $(( 100 * 1024 * 1024 )) for most programs only out of laziness, but if I knew that the program is huge (Firefox), I would become much larger.

+5
source

All Articles