How to disable core dumps in Linux CentOS server?

How to disable core dumps in Linux CentOS server?

What is Core Dump File?
A core dump file is a copy/image of memory(RAM) of an Executable program which get terminated by system due to some error or any other fault. These files are mainly created to debug the error and used by developer to overcome the issue.

How to disable core dump files?
To disable core dump file you have to follow the below given steps:

1. Login to SSH as root.

2. Open the file /etc/security/limits.conf to limit '0'.
# vi /etc/security/limits.conf
Now, set:
Code:
* hard core 0
Save the file. It will hard limit to 0 for every user so that the user cannot increase that limit in his own session.

3. Add this code "fs.suid_dumpable = 0" to file /etc/sysctl.conf
# echo 'fs.suid_dumpable = 0' >> /etc/sysctl.conf
# sysctl -p
This code will ensure not to make any core dumps by setuid programs in future.

4. Now last, add this code "ulimit -S -c 0 > /dev/null 2>&1" to file /etc/profile
# echo 'ulimit -S -c 0 > /dev/null 2>&1' >> /etc/profile
This code will make soft limit and ensure to stop creation of core dumps for all users.
Author
bhawanisingh
Views
16,748
First release
Last update
Rating
0.00 star(s) 0 ratings
Top