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:

  1. Open a terminal and log in as the root user.
  2. Edit the /etc/security/limits.conf file:
    vi /etc/security/limits.conf
  3. 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.

  4. Save and close the file.
  5. Edit the /etc/sysctl.conf file:
    vi /etc/sysctl.conf
  6. 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.

  7. Save and close the file.
  8. Reload the sysctl settings:
    sysctl -p
  9. 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.

Leave a Comment