• Mac OS X,  Mac OS X Server,  Mac Security

    Programmatically Grab The Location Of An Account

    Namespace conflicts can be interesting. Especially with multiple local domains. To grab the path of a directory domain of a currently logged in user (when running as the user) using a script, you can run the following: dscl . -read /Users/`whoami` | grep AppleMetaNodeLocation | awk '{print $2}' You can then replace the string we’re using with grep if you’d like to pull a different attribute from the user record, you’d use the following: dscl . -read /Users/`whoami` | grep UniqueID | awk '{print $2}'

  • Mac OS X Server

    Querying ldapsearch

    Need to perform lookups on Open Directory from Linux? Need to determine a search base to use an LDAP plug-in for a third party with Active Directory? Determining the layout of a directory service can be important for a number of tasks. Most of these have to do with connecting systems of different platforms with one another. In OS X, there are a number of tools that will look up directory service information. Most are based on ldapsearch. Using ldapsearch, you can determine whether a search base is good, whether a directory service responds to a given request and validate some assumptions you may have about an LDAP environment. Let’s…