Menu

#295 SU_OPTS has no effect on RedHat

v3.5.23
open
nobody
None
5
2017-01-31
2017-01-31
Kai Kramer
No

If RUN_AS_USER has no shell set, SU_OPTS can be used to specify the shell.

However, on RedHat SU_OPTS has no effect, because the script automatically uses /sbin/runuser instead of su and does not pass SU_OPTS to runuser:

   if test -f "/sbin/runuser"
    then
        /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
    else
        $SU_BIN - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" $SU_OPTS
    fi

The runuser command allows to specify the shell just like su, so the same workaround (SU_OPTS="-s /bin/bash") would work just fine:

# /sbin/runuser --help
...
-s, --shell=SHELL            run SHELL if /etc/shells allows it

Discussion


Log in to post a comment.

MongoDB Logo MongoDB