From: Antonio Ospite Date: Mon, 18 Mar 2013 16:44:40 +0000 (+0100) Subject: Use "sudo -H" to cover the case when env_keep+="HOME" is set in /etc/sudoers X-Git-Url: https://git.ao2.it/xudo.git/commitdiff_plain/c2b73b518df1eec1679dd7240e2b441729aba290?ds=inline;hp=eaed0fbc27dcba6de96937f2443366ac879309c5 Use "sudo -H" to cover the case when env_keep+="HOME" is set in /etc/sudoers --- diff --git a/xudo.sh b/xudo.sh index 7dc3b3f..6947d7b 100755 --- a/xudo.sh +++ b/xudo.sh @@ -71,7 +71,8 @@ id $USERNAME > /dev/null || { echo "Invalid user." 1>&2; exit 1; } [ "x$@" != "x" ] || { usage 1>&2; exit 1; } # Authorize the user. -xauth extract - $DISPLAY | sudo -u "$USERNAME" xauth merge - +# Use "sudo -H" to cover the case when env_keep+="HOME" is set in /etc/sudoers +xauth extract - $DISPLAY | sudo -H -u "$USERNAME" xauth merge - # Execute the command. # NOTE: -i or -s can be passed in order to open a shell