By examining the /etc/passwd file, I should get a list of all users in the system. However, when dumping the passwd file on Mac OS X I don't see my current username but many entries like these:

  _xgridagent:*:86:86:Xgrid Agent:/var/xgrid/agent:/usr/bin/false
  _appowner:*:87:87:Application Owner:/var/empty:/usr/bin/false
  _tokend:*:91:91:Token Daemon:/var/empty:/usr/bin/false

How come I can log into the shell with my username and see that username when I do who?

migrated from stackoverflow.com Sep 22 '10 at 1:56

This question came from our site for professional and enthusiast programmers.


The /etc/passwd file is only consulted when the OS is in single-user mode. The "standard" location for account information on OS X is the DirectoryService.

Try man DirectoryService for more information.

The following comment block appears at the top of my password file:

# User Database
# Note that this file is consulted directly only when the system is running
# in single-user mode.  At other times this information is provided by
# Open Directory.
# This file will not be consulted for authentication unless the BSD local node
# is enabled via /Applications/Utilities/Directory Utility.app
# See the DirectoryService(8) man page for additional information about
# Open Directory.

In recent versions of OS X Directory Utility has been moved to /System/Library/CoreServices/Directory Utility.

  • I went looking for something like that (Directory Utility) - and it isn't there in my Snow Leopard install...any idea what I could be missing - how it got there on yours? – Jonathan Leffler Sep 21 '10 at 17:09
  • Hmmm...Apple says "Mac OS X v10.5 includes two utilities used to bind computers to Microsoft Active Directory. Directory Utility is an application, and dsconfigad is a command-line utility accessed through Terminal. Both may be used to configure the Active Directory connector in Directory Utility." – Jonathan Leffler Sep 21 '10 at 17:23
  • It's not installed in the advertised location, nor does it appear in spotlight. Looks like my password file is lying to me. – Steve Weet Sep 21 '10 at 17:28
  • My password file tells the same fib. I did find dsconfigad. – Jonathan Leffler Sep 21 '10 at 22:41
  • 2
    Added the new location of directory utility. – Alan Shutko Aug 22 '13 at 19:40

There is a set of Directory Services which keeps the information. There are a series of command line tools (dscl for one) to manipulate them (hard) or you can use System Preferences to handle some of them.


OS X doesn't use the UNIX/LINUX /etc/passwd files. Instead, it stores it in NetInfo. The command used to interact with NetInfo is the directory service command utility, or dscl.

I'm not familiar with the commands, but I'm sure a simple man dscl wouldn't hurt anyone.

  • 2
    NetInfo was replaced by Directory Services as of Mac OS X 10.5 and newer. – Chealion Oct 1 '10 at 2:27

Mac OS X uses Open Directory.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.