Skip to content

unsudo can cause problems if profile writes to output #35

Open
@AndrewSav

Description

@AndrewSav

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions