avoid core files

Hy,
I'd like to avoid the creation of core dump files
I've read it's possible to do this with
Code:
limit coredumpsize 0
in /etc/csh.login

But I'd like to apply that on my user which use a bash shell .
Do you think that this option is correct ?
Code:
ulimit -c 0
in .bash_profile

Or is there a better way ?

Thanks !
 
I already have this option but I still have core dump files
Code:
ls *.core
python3.6.core   soffice.bin.core VBoxSVC.core

Code:
cat /etc/rc.conf | grep dump
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
 
 
You could add dumpdev="NO" to your /etc/rc.conf file.
That is for the dump that the OS creates when it crashes, not for the core files that individual programs create.

For stopping those, the limit (csh) or ulimit (sh) technique should work. One of the things that makes that technique a bit difficult is that these commands need to be executed in the environment of the program itself. For programs that are started from the shell command line, that's easy, since they run in the environment of the current shell. But many interestingly complex programs are started in different ways, for example from rc if they are servers, via ssh or similar mechanisms for remote invocation, and sometimes from GUIs. Those may be considered non-interactive programs as far as the shell is concerned. You have to make sure whatever shell startup file (.cshrc, .profile, .bashrc, ...) you put the limit/ulimit command in will actually be executed, and you need to make sure the commands are not hidden behind if statements: Most of these startup files have a long section of settings that only apply to interactive commands.
 
Back
Top