You can use the SUDO_USERSUDO_USER variable:
sudo bash -c 'echo $SUDO_USER'
sudo bash -c 'echo $SUDO_USER'
From the sudosudo man page:
if sudo is run by root andsudo utilizes the SUDO_USER following environment variable is set, sudo will use this value to determine whovariables. The security policy has control over the actual user iscontent of the command's environment. This can [...]
SUDO_UIDbe used by a userSet to log commands throughthe user ID of the user who invoked sudo even when a root shell.
SUDO_USERhas beenSet to the login name of the user who invoked sudo.