The process I'm running sometimes generates core file, and that file has following file permissions:

server:~ # ls -l /mnt/process/core/core_segfault 
-rw------- 1 root root 245760 Dec  2 11:29 /mnt/process/core/core_segfault

The issue is that only root user can open it for investigation, while I'd like everyone with access to it to be able to read it without me always setting permissions manually.

How could I set default permissions to something like -rw-rw-rw-?

2 Answers 2


Since core files contain the complete memory layout of the process at the time it crashed, they may contain sensitive information. For this reason, core files are created with ownership set to the uid of the process at the time of its crash, and permissions set rather restrictive. There is no setting to change that easily.

However, what you can do is to set the kernel.core_pattern sysctl setting to a program (which must start with a pipe character, |). The kernel will then call that program when a core file is generated, instead of dumping it to disk. This program should be able to generate the core file with the permissions you want.

Examples of programs that do so are systemd-coredump and apport.

  • More on pipes in core_patterns can be found here link
    – crollywood
    Commented Jan 2, 2017 at 10:23

This worked for me: it made the file readable by everyone, 644 instead of 600. After reading Wouter comment.

sudo bash -c 'echo "|/usr/bin/env tee /proc/%P/cwd/core.%h.%e.%p" \
  > /proc/sys/kernel/core_pattern'


If you want to extend the solution, read limitations below. To troubleshot, your script, use dmesg to see the kernel logs from $LINUX/fs/coredump.c::do_coredump

Note that quotes are removed from the core_pattern command the command is given all arguments split at spaces, so I did not manage to run multiple command:

  1. bash -c "echo 1; echo 2" will fail as it only receives echo (the first argument)
  2. echo 1; echo 2 will also fail, echoing 1;, echo and 2. Same goes using && or | or even the desired > so you cannot cat. RedHat recommends creating a script in an absolute path.

From man 5 core

  • The program must be specified using an absolute pathname (or a pathname relative to the root directory, /), and must immediately follow the '|' character.
  • The process starts with its current working directory as the root directory. If desired, it is possible change to the working directory of the dumping process by employing the value provided by the %P specifier to change to the location of the dumping process via /proc/[pid]/cwd.
  • Since kernel 5.3.0, the pipe template is split on spaces into an argument list before the template parameters are expanded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .