How to return user name in a script even if run by SUDO?
derek at pointerstop.ca
Tue Apr 7 01:56:59 UTC 2009
Arch Willingham wrote:
> How do I return the name of the user in a script even if it is fired off
> by SUDO?
# sudo -i
(I'm sure i could figure out how to do it in one line, but that does the
That will show you that, in the sudo environment, a few extra variables are
declare -x SUDO_COMMAND="/bin/bash"
declare -x SUDO_GID="1000"
declare -x SUDO_UID="1000"
declare -x SUDO_USER="derek"
More information about the ubuntu-users