Linux Disable Core Dumps
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.conffile:vi /etc/security/limits.conf - Add the following line at the end of the file:
* hard core 0This will set the maximum size of a core dump to 0 for all users.
- Save and close the file.
- Edit the
/etc/sysctl.conffile:vi /etc/sysctl.conf - Add the following line at the end of the file:
kernel.core_uses_pid = 1This 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.
