• 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: current user if started from /Library/StartupItems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: current user if started from /Library/StartupItems


  • Subject: Re: current user if started from /Library/StartupItems
  • From: Kris Amico <email@hidden>
  • Date: Mon, 03 Feb 2003 19:08:44 -0800

Polling ps and parsing the results is one way to do it, but also could one
not use SCDynamicStoreCopyConsoleUser from the SystemConfiguration
framework? Cool thing about this approach is that you may also passively
listen for a change to that data in the dynamic store so that you never have
to poll anything at all or do any parsing. I think that data lives in the
dynamic store at "State:/Users/ConsoleUser". In fact,
SCDynamicStoreKeyCreateConsoleUser can create this SCD notification key for
you.

On 2/3/03 5:25 PM, "Sherm Pendley" <email@hidden> wrote:

> On Monday, February 3, 2003, at 08:06 PM, Frank Fenn wrote:
>
>> The problem is that every function NSUserName, getenv("USER"),
>> getiud() returns the root user.
>
> That's not a bug, it's a *feature*. :-) Those functions are returning
> the correct answer, as anything that's run as a StartupItem is run as
> root.
>
>> How do I get the actual console user?
>
> You could periodically do a "ps -alx" and parse its output to see what
> user ID the Finder, Dock, WindowServer, etc., are running under.
>
> sherm--
>
> UNIX: Where /sbin/init is Job 1.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.


--
Kris Amico <email@hidden>, AIM: Kris Amico
Senior Software Engineer
Macintosh Client Software Development
EarthLink, Inc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: current user if started from /Library/StartupItems (From: Sherm Pendley <email@hidden>)

  • Prev by Date: IB palettes and [NSBezierPath setDefaultLineWidth:]
  • Next by Date: Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
  • Previous by thread: Re: current user if started from /Library/StartupItems
  • Next by thread: Inter process communication question
  • Index(es):
    • Date
    • Thread