How to disable core dumps in Linux including systemd

You can disable core dumps in Linux, including systems that use systemd, by performing the following steps:

  1. Change the core dump pattern to prevent core dumps from being written to disk by adding the following line to the file /etc/sysctl.conf:
fs.suid_dumpable = 0
  1. Reload the sysctl configuration by running:
sudo sysctl -p
  1. Check if core dumps are enabled by running:
ulimit -c
  1. To disable core dumps for the current session, run this command:
ulimit -c 0
  1. To disable core dumps permanently, add the following line to the /etc/security/limits.conf file:
* hard core 0
  1. For systemd based systems, you can disable core dumps by using the following command:
sudo systemctl disable coredump.service
  1. To disable core dumps globally and prevent them from being generated altogether, you can configure the kernel core dump pattern by adding the following line to the /etc/sysctl.conf file:
kernel.core_pattern = /dev/null

Please note that disabling core dumps will prevent them from being generated, but it might also prevent troubleshooting and debugging of issues that might occur. It’s always a good idea to check the Linux website for the latest version and other options.

Also, it’s recommended to check the system’s log files for core dump messages, to ensure that the core dumps are disabled properly.

Leave a Comment