Where does sudo get the currently logged in username from?

view full story

http://unix.stackexchange.com – When I tried to "sudo su" instead of "sudo su -" after having been logged in as root and su-ing to another user, it tries to sudo me as the new user, but via root... When I type env, it shows still username=root in the environment. Is sudo not looking at the currently logged in user, but at the enviroment parameters? [oracle@tst-01]$ sudo su grid Sorry, user oracle is not allowed to execute '/bin/su grid' as root on tst-01.testdomain.com. [oracle@tst-01]$ env HOSTNAME=tst-01.testdomain.com TERM=xterm SHELL=/bin/bash HISTSIZE=1000 QTDIR=/usr/lib64/qt-3.3 USER=oracle SUDO_USER=ujjain USERNAM (HowTos)