bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

whoami problem when two or more users have the same uid


From: flaviano petrocchi
Subject: whoami problem when two or more users have the same uid
Date: Fri, 8 Aug 2008 11:09:57 +0200

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]