Enable Core Dumps for Daemons or Services in Red Hat Enterprise Linux
Daemons normally run as background processes and can be started with the service command or an init script. Enabling core dumps (see Core dump file) helps with program debugging or investigating errors as needed. Enable core dumps for a daemon or service as follows.
- Edit /etc/profile with vi /etc/profile.
แก้ไขบรรทัด
ulimit -S -c 0 > /dev/null 2>&1
แก้ไขเป็น
ulimit -c unlimited >/dev/null 2>&1
-
Add DAEMON_COREFILE_LIMIT=‘unlimited’ to /etc/sysconfig/init.
-
Normally, programs running setuid cannot create core dumps, to prevent data leaking to other users. Enable core dumps for setuid programs as well.
- For Red Hat Enterprise Linux 5:
echo 2 > /proc/sys/fs/suid_dumpable- For Red Hat Enterprise Linux 4:
echo 2 > /proc/sys/kernel/suid_dumpable- For Red Hat Enterprise Linux 3:
echo 1 > /proc/sys/kernel/core_setuid_ok -
Add the following lines to /etc/sysctl.conf.
fs.suid_dumpable = 2 # RHEL 5 only
kernel.suid_dumpable = 2 # RHEL 4 only
kernel.core_setuid_ok = 1 # RHEL 3 only
kernel.core_pattern = /tmp/core
- Reload the settings with sysctl -p.
Thanks to Red Hat for the information.