How to disable core dump generation in Centos (cPanel Server)?

14,083

Solution 1

You need to execute ulimit -c 0 in the script that starts the webserver, probably /etc/init.d/apache or /etc/init.d/httpd. Place it near the top, but don't make it the first line.

Alternatively you can change the way the core dump is written, so that subsequent core dumps overwrite the previous instead of creating a new file. Add these lines to /etc/sysctl.conf:

kernel.core_uses_pid = 0
kernel.core_pattern = core

and run sysctl -p. Now the core dumps will be named simply core.

You could now also create a zero-sized file owned by root with no write permissions; as the core dump is written with the privileges of the process owner, it won't be able to overwrite that file, hence no core dump.

Solution 2

Check if your CentOS has Automatic Bug Reporting Tool (ABRT) installed and running. See https://fedorahosted.org/abrt/wiki/AbrtDeployment2 for more info.

In short if abrtd deamon is running then it is what handles creation of core dump files. In this case, you need to configure abrtd deamon via /etc/abrt/abrt.conf.

You may use "BlackList" directive to exclude the binaries.

Share:
14,083

Related videos on Youtube

Mani
Author by

Mani

Updated on September 18, 2022

Comments

  • Mani
    Mani over 1 year

    I want to disable core dump generation, How can I disable it ? One of the website keeps generating core dumps every second and eats up all the disk space.

    OS Details: 
    CentOs 
    cPanel Server 
    cloudlinux server
    

    core dump files are generated in public_html folder. I have followed the steps mentioned as in the http://www.cyberciti.biz/faq/linux-disable-core-dumps/ (does not seem to be working)