NetInfo


The NetInfo system is a hierarchical database that stores user and system information that is frequently shared among systems on a local network. It is similar in scope and function to NIS (page 945). NetInfo information is divided into domains, with searches beginning in the local domain and proceeding to higher-level domains as needed. This setup allows local servers to handle requests for local resources and to hand off requests to other servers if necessary. In a default installation, the local domain (.) and the root domain (/) are the same.

Each domain comprises nodes, each of which has one or more properties, and some of which hold other nodes. A property is a name/value pair that allows the system to look up attributes such as the username or UID corresponding to a user account. As in the OS X filesystem, nodes that hold other nodes are called directories. Table 11-1 lists the standard top-level directories for a domain.

Table 11-1. NetInfo top-level directories

Directory

Contents

aliases

Mail aliases, such as mailing lists

groups

Groups

machines

Host information, such as IP addresses

mounts

Filesystem mount information

networks

A list of known networks (now replaced by DNS)

printers

Available printers and their characteristics

protocols

Protocols, such as IP or UDP

rpcs

RPC service numbers

services

Internet service numbers, such as 80 for HTTP

users

System user database, including home directories and passwords


The following example uses nireport to list the names of all top-level directories in the root domain:

$ nireport / / name users groups machines networks ... 


The nireport utility takes at least three arguments. The first argument is the name of the domain to search, typically / (the root domain). The second argument specifies a path to search within that domain. The / path is the top level, analogous to the root of the UNIX filesystem. Using /users as a second argument would cause nireport to search the user accounts. The third and following arguments specify the properties for which you want nireport to display information.

The users top-level directory contains one subdirectory for each user account. Each of these subdirectories includes a name/username property and a uid/UID property. The next command displays the values associated with the name and uid names of each directory in the /users directory of the root domain:

$ nireport / /users name uid nobody  -2 root    0 daemon  1 ... zach    501 sam     502 max     503 


On a typical Mac OS X installation, you can browse the NetInfo database using the NetInfo Manager application (found in the Utilities folder within Applications). If you have administrator privileges, you can use NetInfo Manager to modify the NetInfo database. Under Mac OS X Server, the Server Admin and Workgroup Manager applications also work with the NetInfo databases. Table 11-2 lists the command line utilities that work with the NetInfo database.

Table 11-2. Command line utilities that work with NetInfo

Utility

Function

nidump

Dumps NetInfo databases as text (see CMDREF)

nifind

Finds a given directory in the NetInfo hierarchy

nigrep

Lists directories containing items matching a regular expression

nireport

Displays fields from entries in a NetInfo database

niload

Reads a flat file database into NetInfo

niutil

Manipulates and displays a NetInfo database


The nidump utility displays all of the properties and subdirectories of a node in the database. The following example displays the properties for Max's account:

$ nidump -r /users/max / { "name" = ( "max" ); "_writers_passwd" = ( "max" ); "_writers_tim_password" = ( "max" ); "_writers_picture" = ( "max" ); "shell" = ( "/bin/bash" ); "_writers_hint" = ( "max" ); "home" = ( "/Users/max" ); "gid" = ( "503" ); "authentication_authority" = ( ";ShadowHash;" ); "_writers_realname" = ( "max" ); "picture" = ( "/Library/User Pictures/Animals/Dog.tif" ); "passwd" = ( "********" ); "realname" = ( "Max" ); "hint" = ( "" ); "sharedDir" = ( "Public" ); "_shadow_passwd" = ( "" ); "uid" = ( "503" ); "generateduid" = ( "C7A16427-E9B9-11D9-83B0-000D935C83CE" ); } 


The NetInfo database is substantially more flexible than traditional UNIX flat files, and it can be extended as needed. For more information see the netinfo man page in section 5 of the system manual.




A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net