System Administration Guide: Naming and Directory Services (NIS+)

nisaddent Command

The nisaddent command loads information from text files or NIS maps into NIS+ tables. It can also dump the contents of NIS+ tables back into text files. If you are populating NIS+ tables for the first time, see the instructions in Populating NIS+ Tables. It describes all the prerequisites and related tasks.

You can use nisaddent to transfer information from one NIS+ table to another (for example, to the same type of table in another domain), but not directly. First, you need to dump the contents of the table into a file, and then load the file into the other table. Be sure, though, that the information in the file is formatted properly. Chapter 10, NIS+ Tables and Information describes the format required for each table.

When you load information into a table, you can use any of three options: replace, append, or merge. The append option simply adds the source entries to the NIS+ table. With the replace option, NIS+ first deletes all existing entries in the table and then adds the entries from the source. In a large table, this adds a large set of entries into the table's .log file (one set for removing the existing entries, another for adding the new ones), taking up space in /var/nis and making propagation to replicas time consuming.

The merge option produces the same result as the replace option but uses a different process, one that can greatly reduce the number of operations that must be sent to the replicas.

With the merge option, NIS+ handles three types of entries differently:

When updating a large table with a file or map whose contents are not greatly different from those of the table, the merge option can spare the server a great many operations. Because the merge option deletes only the entries that are not duplicated in the source (the replace option deletes all entries, indiscriminately), it saves one delete and one add operation for every duplicate entry.

If you are loading information into the tables for the first time, you must have create rights to the table object. If you are overwriting information in the tables, you must have modify rights to the tables.

nisaddent Command Syntax

To load information from text files, use:

/usr/lib/nis/nisaddent -f filename table-type\[domain]
/usr/lib/nis/nisaddent -f filename \
 -t tablename table-type [domain]

To load information from NIS maps, use:

/usr/lib/nis/nisaddent -y NISdomain table-type\
/usr/lib/nis/nisaddent -y NISdomain -t tablename table-type [domain]
/usr/lib/nis/nisaddent -Y map table-type [domain]
/usr/lib/nis/nisaddent -Y map -t tablename table-type [domain]

To dump information from an NIS+ table to a file, use:

/usr/lib/nis/nisaddent -d [-t tablename tabletype] \
 > filename

Loading Information Into NIS+ From a File

You can transfer the contents of a file into an NIS+ table in several different ways:

The following two examples load the contents of a text file named /etc/passwd.xfr into the NIS+ Passwd table. The first is into a table in the local domain, the second into a table in another domain:

rootmaster# /usr/lib/nis/nisaddent -f /etc/passwd.xfr passwd
rootmaster# /usr/lib/nis/nisaddent -f /etc/shadow.xfr shadow
rootmaster# /usr/lib/nis/nisaddent -f /etc/passwd.xfr passwd
rootmaster# /usr/lib/nis/nisaddent -f /etc/shadow.xfr shadow

Note –

When creating an NIS+ passwd table from /etc files, you must run nisaddent twice. You run the command once on the /etc/passwd file and once on the /etc/shadow file.

Note –

On a system that is running a release prior to the Solaris 10 7/07 release, you must place IPv6 addresses into NIS+. To merge entries from the /etc/inet/ipnodes file (IPv6 addresses) into the ipnodes.org_dir table, use the -v and -f options.

rootmaster# /usr/lib/nis/nisaddent -mv -f  /etc/inet/ipnodes ipnodes

Another way is to use stdin as the source. However, you cannot use the -m option with stdin. You can use redirect (->) or pipe (-|), but you cannot pipe into another domain.




cat filename > nisaddent table-type

Redirect with append option 

cat filename > nisaddent -a table-type

Redirect with append into another domain 

cat filename > nisaddent -a table-type NIS+ domain


cat filename | nisaddent table-type

Pipe with append option 

cat filename | nisaddent -a table-type

If the NIS+ table is an automounter table or a nonstandard table, add the -t option and the complete name of the NIS+ table.

master# nisaddent -f /etc/auto_home.xfr \
master# nisaddent -f /etc/auto_home.xfr \
  -t key-value

Loading Data From an NIS Map Into NIS+

You can transfer information from an NIS map in two different ways; either by specifying the NIS domain or by specifying the actual NIS map. If you specify the domain, NIS+ will figure out which map file in /var/yp/nisdomain to use as the source, based on the table-type. Note that /var/yp/nisdomain must be local files.

NIS+ Table Type 

NIS Map Name 




ipnodes.byaddr (Not used as of the Solaris 10 7/07 release)

















To transfer by specifying the NIS domain, use the -y (lowercase) option and provide the NIS domain in addition to the NIS+ table type.

Table replacement

nisaddent -y nisdomain table-type

Table append

nisaddent -a -y nisdomain table-type

Table merge

nisaddent -m -y nisdomain table-type

By default, nisaddent replaces the contents of the NIS+ table with the contents of the NIS map. Use the -a and -m options to append or merge. Here is an example that loads the NIS+ passwd table from its corresponding NIS map (passwd.byname) in the old-doc domain:

rootmaster# /usr/lib/nis/nisaddent -y old-doc passwd

This example does the same thing, but for the domain instead of the local domain,

rootmaster# /usr/lib/nis/nisaddent -y old-doc passwd

If the NIS+ table is an automounter table or a nonstandard table, add the -t option and the complete name of the NIS table, just as you would if the source were a file.

rootmaster# nisaddent -y old-doc \
  -t key-value
rootmaster# nisaddent -y old-doc \
  -t key-value

If instead of using the map files for a domain, you prefer to specify a particular NIS map, use the -Y (uppercase) option and specify the map name.

rootmaster# nisaddent -Y hosts.byname hosts
rootmaster# nisaddent -Y hosts.byname hosts

If the NIS map is an automounter map or a non standard map, combine the -Y option with the -t option:

rootmaster# nisaddent -Y auto_home 
 -t key-value
rootmaster# nisaddent -Y auto_home 
 -t key-value

Dumping the Contents of an NIS+ Table to a File

To dump the contents of an NIS+ table into a file, use the -d and -t options. The -d options tells the command to dump, and the -t option specifies the NIS+ table:

rootmaster# nisaddent -d auto_home 
 -t key-value 
rootmaster# nisaddent -d auto_home 
 -t key-value