A core dump is a file that contains the memory image of a process when it crashes. By default, core dumps are enabled on most Linux distributions. However, in some cases, you may want to disable core dumps to save disk space or to prevent sensitive data from being written to disk.
Here’s how to disable core dumps on Linux:
- Open a terminal and log in as the root user.
- Edit the
/etc/security/limits.conf
file:vi /etc/security/limits.conf
- Add the following line at the end of the file:
* hard core 0
This will set the maximum size of a core dump to 0 for all users.
- Save and close the file.
- Edit the
/etc/sysctl.conf
file:vi /etc/sysctl.conf
- Add the following line at the end of the file:
kernel.core_uses_pid = 1
This will include the process ID in the name of the core dump file.
- Save and close the file.
- Reload the sysctl settings:
sysctl -p
- Restart the computer or the process(es) whose core dumps you want to disable.
With these settings, Linux will no longer generate core dump files when a process crashes. Note that some applications may have their own settings to enable or disable core dumps, so you may need to check the documentation or configuration files of individual applications.