home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeMac OS X for Unix GeeksSearch this book

3.6. NetInfo Command Reference

This section provides an overview of the NetInfo command-line utilities used in this chapter. The following sections, Section 3.7 and Section 3.8, demonstrate how to use nicl, nireport, nidump, and niload. For more details on these or other NetInfo utilities, see their respective manpages.

nidump

Syntax

nidump [-T timeout] (-r directory|format) [-t] domain

Description

You can dump NetInfo information in a flat file format (such as the /etc/hosts format) or in a raw format that uses a C-like syntax:

{
  "name" = ( "localhost" );
  "ip_address" = ( "127.0.0.1" );
  "serves" = ( "./local" );
}

Options

-T timeout
Specifies a timeout in seconds.

-t
Treats the domain as a tagged domain, which includes a machine name and a tagged NetInfo database. For example, abbot/local refers to the local NetInfo domain of the machine named abbot.

-r directory
Dumps the directory in raw format. Directory should be a path to a NetInfo directory, such as /users/root or /machines.

format
Specifies a format corresponding to a Unix flat file of the same name. Can be one of: aliases, bootptab, bootparams, ethers, exports, fstab, group, hosts, networks, passwd, printcap, protocols, resolv.conf, rpc, services, or mountmaps.

domain
Specifies a NetInfo domain. For standalone machines, use a dot (.), which refers to the local domain.

nireport

Syntax

nireport [-T timeout] [-t] domain directory [property ...]

Description

You can list all NetInfo groups by using the nireport utility. To use nireport, use the following syntax:

Options

-T timeout
Specifies a timeout in seconds.

-t
Treats the domain as a tagged domain, which includes a machine name and a tagged NetInfo database.

domain
Specifies a NetInfo domain.

directory
Denotes a path to a NetInfo directory.

property ...
Specifies one or more NetInfo properties. For example, each user listed in the /users directory has name, passwd, uid, and gid properties (as well as a few other properties). Every directory has a name property that corresponds to the directory name. For example, the /machines directory's name property is machines.

You can use nireport to list any portion of the NetInfo directory. For example, to list the top-level directory, specify the local domain, the / directory, and the name property, as in nireport . / name.

niload

Syntax

niload  [-v] [-T timeout] [(-d|-m)] [(-p|-P password)]
 [-u user] {-r directory|format} [-t] domain

Description

niload reads the Unix flat file format from standard input and loads it into the NetInfo database.

Options

-v
Selects verbose mode.

-T timeout
Specifies a timeout in seconds.

-d
Specifies that if a duplicate entry already exists, NetInfo deletes that entry before adding the new one. This can cause you to lose data if NetInfo is tracking information that isn't represented in the flat file. For example, if you dump the /users directory to a flat passwd file format and load it back in with niload -d, you will lose the picture, hint, and sharedDir properties for every user on your system, because the passwd file does not have a field for those properties. Most of the time, the -m option is what you want.

-m
Specifies that if a duplicate entry already exists, niload will merge the changes. So, if you dump the /users directory to a flat passwd file format, change a user's shell, and load that file back in with niload, NetInfo will keep the old shell. If you use the -m option, NetInfo will accept the new shell without the destructive side effects of the -d option.

-p
Prompt for a password. You can use this instead of prefixing the command with sudo.

-P password
Use the specified password.

WARNING: If your shell history file is enabled, the -P option presents a security risk, since the password will be stored, along with the history of other shell commands. It is best to avoid using this option.

-u user
Use the specified user's identity when running the command. You'll be prompted for a password.

-t
Treats the domain as a tagged domain, which includes a machine name and a tagged NetInfo database.

domain
Specifies a NetInfo domain.

directory
Denotes a path to a NetInfo directory.

format
Specifies a format corresponding to a Unix flat file of the same name. Can be one of the following: aliases, bootptab, bootparams, exports, fstab, group, hosts, networks, passwd, printcap, protocols, rpc, or services.

nicl

Syntax

nicl [options] datasource [command]

Description

Use nicl to modify entries in the NetInfo database. You can manipulate directories and properties with nicl. The datasource may be the path to a NetInfo directory (such as / ) or the filesystem path of a NetInfo database (you must use the -raw option for this). Use -raw to work directly with the NetInfo database, such as /var/db/netinfo/local.nidb. This is useful in cases when the NetInfo daemon is down (such as when you boot into single-user mode).

Options

-c
Create a new data source.

-p
Prompt for a password. You can use this instead of prefixing the command with sudo.

-P password
Use the specified password.

-q
Be quiet.

-raw
Indicates that the datasource is a filesystem path to a NetInfo database.

-ro
Open datasource as read-only.

-t
Treats the domain as a tagged domain, which includes a machine name and a tagged NetInfo database.

-u user
Use the specified user's identity when running the command. You'll be prompted for a password.

-v
Be verbose.

-x500
Use X.500 names (see the nicl manpage for more details).

Commands

-append path key val ...
Appends a value to an existing property. The property is created if it does not already exist.

-copy path newparent
Copies the specified path to a new parent path.

-create path [key [val ...] ]
Creates a NetInfo directory specified by path. See Section 3.8.2, later in this chapter, for a complete example.

-delete path [key [val ...] ]
Destroys the specified path and all its contents. If you specify a key and/or value, only the specified key is deleted. For an example, see Section 3.7.5, later in this chapter.

-domainname
Prints the NetInfo domain name of datasource.

-flush
Flushes the directory cache.

-insert path key val index
Operates like -append, but instead of placing the value at the end, it inserts it at the specified index.

-list path [key ...]
Lists all the NetInfo directories in the specified path. For example, to list all users, use nicl / -list /users.

-merge path key val ...
Operates like -append, but if the value already exists, it is not duplicated. See Section 3.7.3, later in this chapter.

-move path newparent
Moves the specified path to a new parent path.

-read path [key ...]
Displays all the properties of the specified path. For example, to see root's properties, use nicl / -read /users/root.

-search arguments
Performs a search within the NetInfo database. For complete details, see the nicl manpage.

-rename path oldkey newkey
Renames a property.

-resync
Resynchronizes NetInfo.

-rparent
Prints the NetInfo parent of datasource.

-statistics
Displays NetInfo server statistics.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.