How to enable core dump in CentOS 7

How to enable core dump in CentOS 7?

1. Set the size of core dump to unlimited.
$ ulimit -s unlimited

Confirm it’s configured by
$ ulimit -a

You must see “core file size” is *unlimited*.

[root@hermes ~]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0

This setting will be gone as session changes. Add the “ulimit -c unlimited” to the /etc/profile in order to survive from session changes.

2. Plan where to store the core dump. I recommend “/var/crash” path.
Allow *write permission* to the the core dump path.
$ chmod 777 <core dump path>

Lots of programs run by other user, which may use setuid. The user MUST have the write permission to the path for core dump.

3. Configure core dump pattern by the path planned at previous step.
By root user, run following
$ echo /var/crash/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern

In order to keep this for system reboot, add “kernel.core_pattern=/var/crash/core-%e-%s-%u-%g-%p-%t” to the /etc/sysctl.conf

How to modify/Disable SELinux mode

This is regarding to how to modify/disable SELinux in CentOS 7

Running “setenforce 0” in prompt will disable SELinux temporarilly. This doesn’t survive from system-reboot.

In order to make changes permanently, do following.

-Modify “SELINUX” in /etc/selinux/config

Three different modes of SELINUX. Choose anything you wish. To disable SELinux, simply modify it as “disabled”.

forcing: The default mode which will enable and enforce the SELinux security policy on the system, denying access and logging actions

Permissive: In Permissive mode, SELinux is enabled but will not enforce the security policy, only warn and log actions. Permissive mode is useful for troubleshooting SELinux issues

Disabled: SELinux is turned off