• 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 the full user name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the full user name


  • Subject: Re: getting the full user name
  • From: Rosyna <email@hidden>
  • Date: Mon, 31 Oct 2005 06:10:40 -0700

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:
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>)

  • Prev by Date: Re: Spotlighting databases and preferences...
  • Next by Date: Re: Round button
  • Previous by thread: Re: getting the full user name
  • Next by thread: Re: getting the full user name
  • Index(es):
    • Date
    • Thread