• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting LOGNAME when using sudo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Getting LOGNAME when using sudo (From: Mike <email@hidden>)

  • Prev by Date: Getting LOGNAME when using sudo
  • Next by Date: Re: Poor performance of pthreads across cpu dies.
  • Previous by thread: Getting LOGNAME when using sudo
  • Next by thread: IP address change events?
  • Index(es):
    • Date
    • Thread