Subject: bug#21369: Coreutils RHEL 6.7 runuser

From: Bob Proulx <[email-masked]>
Date: Fri, 28 Aug 2015 17:20:05 -0600

[email-masked] wrote:
> Here is what we're running on RHEL6.7, and it's throwing 99 as the
> return code ($?)
> 
> test:/root#  /sbin/runuser -s /bin/ksh - tomcat -c whoami
> test:/root#  echo $?
> test:/root#  99

I cannot reproduce your problem on a RHEL 6.7 system here.  Therefore
I can only conclude that the problem must be in your local environment.

I am highly suspicious of the '-' option running the tomcat user's
profile and $ENV files.  What is in ~tomcat/profile?

Does the command work without the '-'?

  /sbin/runuser -s /bin/ksh tomcat -c whoami

Does that command work for other users not tomcat?  Perhaps you have
'mysql' already installed?  That would make a good alternative test
case if it happens to be there and if you have tomcat then I think it
likely.

  /sbin/runuser -s /bin/ksh mysql -c whoami

Looking a little further into strace you submitted I see that pid
23575 appears to be ksh and it appears to have segfaulted.

  [pid 23575] --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
  [pid 23575] +++ killed by SIGSEGV +++

That isn't good.  Can you try a different shell?  (On my RHEL 6.7
system /bin/sh is symlinked to bash.)  I also have dash installed by
default too and think it would be a good alternative test case.

  /sbin/runuser -s /bin/sh - tomcat -c whoami
  /sbin/runuser -s /bin/dash - tomcat -c whoami

If 'ksh' is segfaulting then that is likely a problem if not the problem.
Do look closely at the tomcat profile and $ENV (possibly .kshrc)
environment though as I think that is likely involved.

Bob