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

Replace `whoami` with `id -u` test #397

Merged
merged 1 commit into from Feb 10, 2012

Conversation

Projects
None yet
2 participants
@guns
Copy link
Contributor

guns commented Feb 10, 2012

id -u is in the POSIX and LSB specs 1, while whoami is not.
Furthermore, the username of UID 0 can be changed (and is sometimes
recommended in a misguided attempt to increase security).

FreeBSD users logged in as toor would also slip through the cracks.

 http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/command.html
Replace `whoami` with `id -u` test
`id -u` is in the POSIX and LSB specs [1], while `whoami` is not.
Furthermore, the username of UID 0 can be changed (and is sometimes
recommended in a misguided attempt to increase security).

FreeBSD users logged in as `toor` would also slip through the cracks.

[1]: http://pubs.opengroup.org/onlinepubs/009695399/utilities/id.html
     http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/command.html

technomancy added a commit that referenced this pull request Feb 10, 2012

Merge pull request #397 from guns/whoami-id-u
Replace `whoami` with `id -u` test

@technomancy technomancy merged commit d645175 into technomancy:master Feb 10, 2012

@technomancy

This comment has been minimized.

Copy link
Owner

technomancy commented Feb 10, 2012

Works for me; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment