I use an alternate root user with login capabilities, created with
"useradd -u 0 -o -g 0 -G 0 -m -s /bin/bash superuser". If I login with
superuser, whoami returns root or superuser depending on which user
comes before in the /etc/passwd file. echo $USER instead always
returns the correct user name. I think whoami should always report the
correct name maybe retrieving the USER environment variable instead of
parsing the passwd file. Those who use whoami to check if a user is
root should instead use id -u and check if the uid is 0.


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to