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: getting the full user name



Ack, at 10/28/05, John C. Randolph said:

Well, back in the Old Days, you could do this with the NetInfo framework. Today, you could use NSTask to execute "nidump passwd .", which will give you something like this:

Using NetInfo is not recommended for these kinds of Queries any more. The recommended way is to use DirectoryServices, which gives you the same results in a different manner. For example, use dscl instead of nicl.


nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false
root:*:0:0::0:0:System Administrator:/var/root:/bin/sh
...
[snippage.  You get the idea.]
...
securityagent:*:92:92::0:0:SecurityAgent:/var/empty:/usr/bin/false
jcr:********:501:501::0:0:John C. Randolph:/Users/jcr:/bin/bash
foo:********:502:502::0:0:foo:/Users/foo:/bin/bash

Any UIDs less than 500 are probably not real users, unless someone's decided to go against the guidelines in Apple's sysadmin docs.

Not best to use that logic. Since you've got root and uids can be arbitrary. The best test (in my experience) is to see if the user has a valid shell. See your above dump, /usr/bin/false is not a valid shell so the user is not "valid". You cannot trust the home folder test as many default users have valid home folders.
--



Sincerely, Rosyna Keller Technical Support/Holy Knight/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
References: 
 >getting the full user name (From: Herbert <email@hidden>)
 >Re: getting the full user name (From: "John C. Randolph" <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.