Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get user ID (501, 502, etc.)



I *think* this is an error in getuid() when run as an a user that has administrator rights and has authenticated within the last few minutes, I've no t tested it, but it appears to be around three minutes. Interestingly, though getuid() returns 0, calling a task using NSTask assuming that because you have a getuid() of 0 (root) will fail with permission error because the NSTask is still run in the context of the user, not the getuid() result of root.

When it comes to getting and using the console user, it can be entertaining to say the least.

That said, the SystemConfiguration framework method works for getting the current user. I've also seen a need on occasion to identify other user id's using NetInfo (command line) or the OpenDirectory API (http://developer.apple.com/documentation/Networking/Conceptual/ Open_Directory/index.html).

Andy


On Nov 11, 2006, at 5:22 PM, Rosyna wrote:

0 is root. Is this application running as root?

Ack, at 11/11/06, Jerry Krinock said:

Thanks. getuid() returns 0, but this gives the name, user ID and group ID
if you need them..........

--


Sincerely, Rosyna Keller Technical Support/Carbon troll/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: How to get user ID (501, 502, etc.) (From: Jerry Krinock <email@hidden>)
 >Re: How to get user ID (501, 502, etc.) (From: Rosyna <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.