Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsudo can cause problems if profile writes to output #35

Open
AndrewSav opened this issue Sep 8, 2022 · 1 comment
Open

unsudo can cause problems if profile writes to output #35

AndrewSav opened this issue Sep 8, 2022 · 1 comment
Assignees
Labels

Comments

@AndrewSav
Copy link

AndrewSav commented Sep 8, 2022

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.

@udhos udhos added the bug label Sep 9, 2022
@udhos udhos self-assigned this Sep 9, 2022
@udhos
Copy link
Owner

udhos commented Sep 9, 2022

Thanks for reporting.

I will search a way to make unsudo more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants