Re: Getting LOGNAME when using sudo
Re: Getting LOGNAME when using sudo
- Subject: Re: Getting LOGNAME when using sudo
- From: "James Peach" <email@hidden>
- Date: Thu, 30 Aug 2007 21:10:51 -0700
On 30/08/2007, Mike <email@hidden> wrote:
> I have a shell script that needs to get the LOGNAME env variable. But I
> need to run my script using sudo which apparently causes LOGNAME to
> incorrectly be set to "root".
>
> How can can I get the logged in user's name even when running a script
> using sudo?
>
> I need to get the user name because I need to build shell path to the
> current user's desktop and only the exact logged in user's name will work.
>From sudo(8):
ENVIRONMENT
...
SUDO_USER Set to the login of the user who invoked sudo
--
James Peach | email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden