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

Doesn't get real username/userhome when run with sudo #27

Closed
alex94cp opened this issue Jun 9, 2015 · 6 comments
Closed

Doesn't get real username/userhome when run with sudo #27

alex94cp opened this issue Jun 9, 2015 · 6 comments
Labels

Comments

@alex94cp
Copy link
Contributor

alex94cp commented Jun 9, 2015

Maybe this would work, it should check for SUDO_USER/SUDO_UID to check if run with sudo or getpwname otherwise.

@bilelmoussaoui
Copy link
Owner

Thank you for reporting this, this should be fixed in the latest commit

@alex94cp
Copy link
Contributor Author

alex94cp commented Jun 9, 2015

Only now it doesn't work for the root user xd Instead of checking for the uid, you could check for the SUDO_USER variable being present, and if not, fallback to getpwname

@bilelmoussaoui
Copy link
Owner

Ops :P I forgot to remove username as i'm not using it anymore, can you try for the userhome using root user?

@bilelmoussaoui bilelmoussaoui reopened this Jun 9, 2015
@alex94cp
Copy link
Contributor Author

alex94cp commented Jun 9, 2015

Seems that sudo does not change $HOME var, so maybe this is a more elegant solution sudo sh -c "echo $HOME"

@alex94cp
Copy link
Contributor Author

alex94cp commented Jun 9, 2015

I didn't make a commit because for simple fixes I find it a little overkill (all that git stuff xd) but if you want I could give it a try

bilelmoussaoui added a commit that referenced this issue Jun 9, 2015
Another commit #27
@bilelmoussaoui
Copy link
Owner

This is fixed now 👍 , feel free to report any other issues/bugs, thank you!

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