[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 4

nisaddent Command


Creates NIS+ tables from corresponding /etc files or NIS maps.


nisaddent [ -D defaults ] [ -P ] [ -a ] [ -r ] [ -v ] [ -t table ] type [ nisdomain ]

nisaddent [ -D defaults ] [ -P ] [ -a ] [ -p ] [ -r ] [ -m ] [ -v ] -f file [ -t table ] type [ nisdomain ]

nisaddent [ -D defaults ] [ -P ] [ -a ] [ -r ] [ -m ] [ -v ] [ -t table ] -y ypdomain [ -Y map ] type [ nisdomain ]

nisaddent -d [ -A ] [ -M ] [ -q ] [ -t table ] type [ nisdomain ]


The nisaddent command creates entries in NIS+ tables from their corresponding /etc files and NIS maps. This operation is customized for each of the standard tables that are used in the administration of systems. The type argument specifies the type of the data being processed. Legal values for this type are one of aliases, bootparams, ethers, group, hosts, netid, netmasks, networks, passwd, protocols, publickey, rpc, services, shadow, or timezone for the standard tables or key-value for a generic two-column (key, value) table. For a site specific table, which is not of key-value type, you can use nistbladm to administer it.

The NIS+ tables should have already been created by nistbladm, nissetup, or nisserver.

It is easier to use nispopulate instead of nisaddent to populate the system tables.

By default, nisaddent reads from the standard input and adds this data to the NIS+ table associated with the type specified on the command line. An alternate NIS+ table may be specified with the -t flag. For type key-value, a table specification is required.

Note: The data type can be different than the table name ( -t). For example, the automounter tables have key-value as the table type.

Although, there is a shadow data type, there is no corresponding shadow table. Both the shadow and the passwd data is stored in the passwd table itself.

Files may be processed using the -f flag, and NIS version 2 (YP) maps may be processed using the -y flag. The -m flag is not available when reading data from standard input.

When a ypdomain is specified, the nisaddent command takes its input from the dbm files for the appropriate NIS map (mail.aliases, bootparams, ethers.byaddr, group.byname, hosts.byaddr, netid.byname, netmasks.byaddr, networks.byname, passwd.byname, protocols.byname, publickey.byname, rpc.bynumber, services.byname, or timezone.byname). An alternate NIS map may be specified with the -Y flag. For type key-value, a map specification is required. The map must be in the /var/yp/ypdomain directory on the local machine.

Note: ypdomain is case sensitive. The ypxfr command can be used to get the NIS maps.

If a nisdomain is specified, nisaddent operates on the NIS+ table in that NIS+ domain, otherwise the default domain is used.

In terms of performance, loading up the tables is fastest when done through the dbm files (y).


-a Adds the file or map to the NIS+ table without deleting any existing entries. This flag is the default. This mode only propagates additions and modifications, not deletions.
-A Specifies that the data within the table and all of the data in tables in the initial table's concatenation path be returned.
-d Dumps the NIS+ table to the standard output in the appropriate format for the given type. For tables of type key-value, use niscat instead. To dump the credential table, dump the publickey and the netid types.
-D defaults Specifies a different set of defaults to be used during this operation. The defaults string is a series of tokens separated by colons. These tokens represent the default values to be used for the generic object properties. All of the legal tokens are described below:
Sets the default time to live for objects that are created by this command. The value time is specified in the format as defined by the nischttl command. The default is 12 hours.
Specifies that the NIS+ principal ownername should own the created object. The default for this value is the principal who is executing the command.
Specifies that the group groupname should be the group owner for the object that is created. The default is NULL.
access= rights
Specifies the set of access rights that are to be granted for the given object. The value rights is specified in the format as defined by the nischmod command. The default is ----rmcdr---r---.
-f file Specifies that file should be used as the source of input (instead of the standard input).
-m Merges the file or map with the NIS+ table. This is the most efficient way to bring a NIS+ table up to date with a file or NIS map when there are only a small number of changes. This flag adds entries that are not already in the database, modifies entries that already exist (if changed), and deletes any entries that are not in the source. Use the -m flag whenever the database is large and replicated and the map being loaded differs only in a few entries. This flag reduces the number of update messages that have to be sent to the replicas. Also see the -r flag.
-M Specifies that lookups should be sent to the master server. This guarantees that the most up-to-date information is seen at the possible expense that the master server may be busy or that it may be made busy by this operation.
-p Processes the password field when loading password information from a file. By default, the password field is ignored because it is usually not valid (the actual password appears in a shadow file).
-P Specifies that lookups should follow the concatenation path of a table if the initial search is unsuccessful.
-q Dumps tables in "quick" mode. The default method for dumping tables processes each entry individually. For some tables (for example, hosts), multiple entries must be combined into a single line, so extra requests to the server must be made. In "quick" mode, all of the entries for a table are retrieved in one call to the server, so the table can be dumped more quickly. However, for large tables, there is a chance that the process will run out of virtual memory and the table will not be dumped.
-r Replaces the file or map in the existing NIS+ table by first deleting any existing entries and then add the entries from the source (/etc files or NIS+ maps). This flag has the same effect as the -m flag. The use of this flag is strongly discouraged due to its adverse impact on performance, unless there are a large number of changes.
-t table Specifies that table should be the NIS+ table for this operation. This should be a relative name as compared to your default domain or the domainname if it has been specified.
-v Sets verbose mode.
-y ypdomain Uses the dbm files for the appropriate NIS map, from the NIS domain ypdomain, as the source of input. The files are expected to be on the local machine in the /var/yp/ypdomain directory. If the machine is not an NIS server, use the ypxfr command to get a copy of the dbm files for the appropriate map.
-Y map Use the dbm files for map as the source of input.


NIS_DEFAULTS This variable contains a default string that overrides the NIS+ standard defaults. If the -D flag is used, those values will then override both the NIS_DEFAULTS variable and the standard defaults. To avoid security accidents, the access rights in the NIS_DEFAULTS variable are ignored for the passwd table but access rights specified with the -D flag are used.
NIS_PATH If this variable is set and neither the nisdomain nor the table are fully qualified, each directory specified in NIS_PATH will be searched until the table is found (see the nisdefaults command).

Exit Status

This command returns the following exit values:

0 Success
1 Failure caused by an error other than parsing
2 A parsing error occurred on an entry. A parsing error does not cause termination; the invalid entries are simply skipped.


  1. To add the contents of /etc/passwd to the passwd.org_dir table, enter:

    cat /etc/passwd | nisaddent passwd
  2. To add the shadow information, enter:

    cat /etc/shadow | nisaddent shadow

    The table type is shadow, not passwd, even though the actual information is stored in the passwd table.

  3. To replace the hosts.org_dir table with the contents of /etc/hosts (in verbose mode), enter:

    nisaddent -rv -f /etc/hosts hosts
  4. To merge the passwd map from yypdomain with the passwd.org_dir.nisdomain table (in verbose mode), enter:

    nisaddent -mv -y myypdomain passwd nisdomain

    This example assumes that the /var/yp/myypdomain directory contains the yppasswd map.

  5. To merge the auto.master map from myypdomain with the auto_master.org_dir table, enter:

    nisaddent -m -y myypdomain -Y auto.master -t auto_master.org_dir key-value
  6. To dump the hosts.org_dir table, enter:

    nisaddent -d hosts

Related Information

The niscat command, nischmod command, nisdefaults command, nispopulate command, nisserver command, nissetup command, nistbladm command, passwd command, ypxfr command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]