Solved: Disable core generation on a Linux system for all users: RHEL 6,7,8.

In this post, we will see how to disable core generation on Linux.

Lets see the steps we need to follow to disable the core generation on Linux system.

1. Core file size Ulimit for root must be 0.

[root@ngelinux01 ~]# ulimit -a
core file size          (blocks, -c) 0

If not, add below line to /etc/profile.
# echo “ulimit -c 0” >> /etc/profile

 

2. Put below entries in limits.conf to disable core generation for all users(*).

# cat /etc/security/limits.conf

*               soft    core            0
*               hard    core            0

 

3. Run below commands to change core file pattern and to redirect it to false.

# egrep -i ‘dump|core’ /etc/sysctl.conf

If no entries, add below to avoid core generation.
echo "fs.suid_dumpable=0" >> /etc/sysctl.conf
echo "kernel.core_pattern=|/bin/false" >> /etc/sysctl.conf

 

4. Make sure no other ulimit command in boot up files and confirm in core dump configuration, no entries should be there.

[root@ngelinux01 ~]# grep -ir ulimit /etc/profile /etc/rc.*
/etc/rc.d/init.d/functions:    corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}"

              # cat /etc/systemd/coredump.conf

 

5. Disable in systemd config also in case of RHEL 7+.

[root@ngelinux01 ~]# cat /etc/systemd/system.conf | grep -i core
DumpCore=no
DefaultLimitCORE=0

# systemctl daemon-reexec

After these steps, make sure to reboot the system to implement limits.conf file changes for all users.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments