[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

getting a regular user to dump core when a program crashes



i had some fun trying to figure out why a regular user could not
dump a core file and i had all the settings figured out.  since it
was a silly and obvious thing but it stumped me for a bit i 
figured it would be worth sharing.  :)


the answer is at the end...


using Debian testing.


i have my kernel boot line set to:

systemd.dump_core=true


i have these lines in /etc/security/limits.conf:

root            hard    core            unlimited
root            soft    core            unlimited
*               soft    core            unlimited
*               hard    core            unlimited


i have the following set in my /etc/sysctl.conf:

# core file location and file name format
kernel.core_pattern=/crash/core.%u.%E.%p


if i run a program with a known issue (divide by zero) the
core file shows up where it should be if the program is run
by root, but not when a normal user runs it.


what am i missing or what have i screwed up?

root(17)~# ./f
Floating point exception (core dumped)
root(18)~# ls /crash
total 112
-rw------- 1 root root 282624 Feb 28 09:32 'core.0.!root!f.2123'



none of my .bashrc/.profile or etc have anything limited in them
for core file dumps


$ ulimit -a
ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) unlimited
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 30998
max locked memory           (kbytes, -l) 1000392
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 30998
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited


turns out it was as simple as the directory permissions on
/crash.

once i set those to allow the proper access then the crashes
would show up.  for some reason i thought that a crashing
program would have systemd or root handling the saving of 
the core file and so a user would not need special access
to where the core file was landing.


$ ls /crash
total 228
-rw------- 1 root root 282624 Feb 28 09:48 'core.0.!root!f.2537'
-rw------- 1 me   me   282624 Feb 28 09:49 'core.1000.!home!me!f.2546'


  songbird


Reply to: