From: Holger Weiss Date: Thu, 24 Jul 2014 13:25:28 +0000 (+0200) Subject: ejabberdctl: Use $INSTALLUSER's home directory X-Git-Tag: 14.12~91^2^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43000d9ce4148a4b33e31ee217b11d8643fcb2b0;p=ejabberd ejabberdctl: Use $INSTALLUSER's home directory Make sure ejabberdctl uses the $INSTALLUSER's .erlang.cookie file even if the script was executed by root. --- diff --git a/ejabberdctl.template b/ejabberdctl.template index a86694f67..b9f372514 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -22,7 +22,8 @@ if [ "$INSTALLUSER" != "" ] ; then EXEC_CMD="false" for GID in `id -G`; do if [ $GID -eq 0 ] ; then - EXEC_CMD="su $INSTALLUSER -p -c" + INSTALLUSER_HOME=$(getent passwd "$INSTALLUSER" | cut -d: -f6) + EXEC_CMD="env HOME=$INSTALLUSER_HOME su $INSTALLUSER -p -c" fi done if [ `id -g` -eq `id -g $INSTALLUSER` ] ; then