update-golang icon indicating copy to clipboard operation
update-golang copied to clipboard

unsudo can cause problems if profile writes to output

Open AndrewSav opened this issue 3 years ago • 1 comments

unsudo uses sudo -i which cause profile to be executed. When profile is executed it can potentially write to stdout. When the results of unsudo is piped elsewhere this output is unexpected and causes problem.

For a real life example this what raspberry pi profile includes /etc/profile.d/sshpwd.sh:

export TEXTDOMAIN=Linux-PAM

. gettext.sh

if [ -e /run/sshwarn ] ; then
    echo
        echo $(/usr/bin/gettext "SSH is enabled and the default password for the 'pi' user has not been changed.")
        echo $(/usr/bin/gettext "This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.")
        echo
fi

It is easy enough to disable this warning, but the point is, that when sudo -i is used you cannot really expect stdout to be just the stdout of the command run.

AndrewSav avatar Sep 08 '22 23:09 AndrewSav

Thanks for reporting.

I will search a way to make unsudo more robust.

udhos avatar Sep 09 '22 01:09 udhos