NIS+ and FNS Administration Guide
  Sök endast i den här boken
Ladda ner denna bok i PDF

Administering NIS+ Tables

11

This chapter describes how to use the NIS+ table administration commands to perform the following tasks:
Creating a New Tablepage 209
Deleting a Tablepage 211
Adding an Entry to a Tablepage 211
Modifying a Table Entrypage 213
Removing a Single Entry From a Tablepage 214
Removing Multiple Entries From a Tablepage 215
Displaying the Contents of a Tablepage 217
Displaying the Object Properties of a Table or Entrypage 217
Searching the First Columnpage 221
Searching a Particular Columnpage 222
Searching Multiple Columnspage 222
Creating a Linkpage 223
Expanding a Directory Into an NIS+ Domainpage 225
Expanding a Directory Into an NIS-Compatible Domainpage 225
Loading Information From a Filepage 228
Loading Data From an NIS Mappage 229
Dumping the Contents of an NIS+ Table to a Filepage 231
For a complete description of these commands and their syntax and options, see the NIS+ man pages.

The nistbladm Command

Text Box(144x57)

The nistbladm command is the primary NIS+ table administration command. With it, you can create, modify, and delete NIS+ tables and entries. To create a table, its directory must already exist. To add entries to the table, the table and columns must already be defined.
To create a table, you must have create rights to the directory under which you will create it. To delete a table, you must have destroy rights to the directory. To modify the contents of a table, whether to add, change, or delete entries, you must have modify rights to the table or the entries.

Syntax

To create or delete a table, use:

  nistbladm -c table-type columnspec... tablename  
  nistbladm -d tablename  
  
  columnspec ::=     column=[CSI,rights]  

To add, modify, or remove entries, use:

  nistbladm -a  
  nistbladm -A entry  
  nistbladm -m new-entry old-entry  
  nistbladm -r  
  nistbladm -R entry  
  entry ::=column=value ... tablename [column=value,...],tablename  

The columnspec syntax is explained under the task "Creating a New Table" on page 209. The entry syntax is explained under the task "Adding an Entry to a Table" on page 211.

Creating a New Table

An NIS+ table must have at least one column and at least one of its columns must be searchable. To create an NIS+ table, use the nistbladm command with the -c option:

  nistbladm -c table-type columnspec... tablename  

The table-type is simply a string that identifies the table as belonging to a class of tables. It can be any string you choose.
The columnspec argument specifies the name and characteristics of each column. Enter one columnspec for each column you want in your new table. Separate the columns with spaces:

  columnspec columnspec ...  

Each columnspec entry has two to four components in the format:

  name=type,rights:  

Table 11-1
ComponentDescription
nameName of the column
=An equal sign which is required.
type[Optional] The type of column specified by the letters S, I or C (see Table 11-2 on page 210). This component is options. If no type is specified, the column becomes the default type.
rights[Optional] Access rights. These access rights are over and above those granted to the table as a whole or to specific entries. If no access is specified, the column's access rights are those granted to the table as a whole, or to the entry. The syntax for access rights is described in "Specifying Access Rights in Commands" on page 120."
A column can be one of the following types:
Table 11-2
TypeDescription
SSearchable. The nismatch command can search through the column.
ICase-insensitive. When nismatch searches through the column, it will ignore case.
CEncrypted.
If you specify only access rights, you don't need to use a comma. If you include one or more of the S, I, or C flags, add a comma before the access rights.
This example creates a depts-type table named divs in the mydir.wiz.com. directory (the org_dir directory is reserved for system tables).

  master% nistbladm -c depts Name=I Site= Manager=C divs.mydir.wiz.com.  

type
columns
tablename
The table has three columns, Name (searchable, case-insensitive), Site (default characteristics), and Manager (Encrypted). Within any table there should be no two entries with the same values for all searchable columns.
In this example the same table is created with the addition of column-specific access rights applied to the first two columns:

 master% nistbladm -c depts Name=I,w+m Site=w+m Manager=C divs.mydir.wiz.com.  

For more information about specifying column access rights when creating a table, see "Setting Column Rights When Creating a Table" on page 130.

Deleting a Table

To delete a table, use the -d option and enter the table name:

  nistbladm -d tablename  

The table must be empty before you can delete it (see "Removing a Single Entry From a Table" on page 214). This example deletes the divs table from the wiz.com. directory:

  rootmaster% nistbladm -d divs.wiz.com.  

Adding an Entry to a Table

You can add an entry to a table in two ways:
  • With the -a option. The -a option is recommended for administrators.
  • With the -A option. The -A option is designed for applications.

Using the -a Option

The -a option adds an entry to a table unless the entry already exists, in which case it returns an error. To use it, you must specify a value for every column in the table:

  nistbladm -a entry  

To find the name of a particular column, use the niscat -o command. You can use two different syntaxes to specify an entry:

  entry ::=column=value ... tablename [column=value,...],tablename  

The first consists of one or more column=value pairs, separated by spaces and followed by the table name. The second consists of one or more column=value pairs, separated by commas and enclosed in square brackets, followed by a comma and the table name. The second syntax is referred to as an indexed-name.
These two examples add the same entry to the depts table, but they each use a different form:

  rootmaster% nistbladm -a Name='R&D'  Site=SanFran  Manager=vattel depts.wiz.com.  


  rootmaster% nistbladm -a [Name='R&D',Site=SanFran,Manager=vattel], depts.wiz.com.  

NameSiteManager
R&DSanFranvattel
Note that in the two examples above, quotes are used to prevent the shell from interpreting the ampersand (&) in R&D as a metacharacter. C shell users should also use quotes to set off expressions using square brackerts ([).
You can only add one entry with each instance of the nistbladm command. This example adds three more entries to the depts table:

  rootmaster% nistbladm -a [Name=Sales,Site=SanFran, Manager=tsosulu],  depts.wiz.com.  
  rootmaster% nistbladm -a [Name=Manf-1,Site=Emeryville, Manage=hosteen], depts.wiz.com.  
  rootmaster% nistbladm -a [Name=Manf-2,Site=Sausalito, Manager=lincoln], depts.wiz.com.  

NameSiteManager
R&DSanFranvattel
SalesSanFrantsosulu
Manf-1Emeryvillehosteen
Manf-2Sausalitolincoln

Using the -A Option

The -A option is designed for applications. Like the -a option, it adds a new entry to a table. However, if the entry already exists, instead of exiting with an error, it changes the operation to modify, as if the -m option had been used instead. Unlike the -m option, however, with the -A option, you must specify all columns in the entry.
This example demonstrates how -A overwrites an existing entry:
NameSiteManager
R&DSanFranvattel
SalesSanFrantsosulu

  rootmaster% nistbladm -A Name=Sales Site=SanFran Manager=jhill depts.wiz.com.  

NameSiteManager
R&DSanFranvattel
SalesSanFranjhill
The -a option would have returned an error, since the entry specified by Name=Sales Site=SanFran already exists.

Modifying a Table Entry

To modify a table entry, use the -m option:

  nistbladm -m new-entry old-entry  

Specify the new-entry with a set of column=value pairs. Use an indexed name to specify the old-entry and the table name. This example modifies an entry in the depts table:

Imported image(496x108)

(Note that in the example above, quotes are used to prevent the shell from interpreting the ampersand (&) as a metacharacter. C shell users should also use quotes to set off expressions containing a bracket ([) for the same reason.)
NameSiteManager
R&DSanFrankuznetsov
SalesSanFranjhill
Manf-1Emeryvillehosteen
Manf-2Sausalitolincoln

Removing a Single Entry From a Table

To remove a single entry from a table, use the -r option:

  nistbladm -r indexed-name  

This example removes the Manf-1 entry from the depts table:

 rootmaster% nistbladm -r [Name=Manf-1,Site=Emeryville,Manager=hosteen],depts.wiz.com.  

You can specify as few column values as you wish. If NIS+ finds duplicates, it does not remove any entry and returns an error message instead. Thus, you could have removed the Manf-1 by specifying only the Site column value, as in this example:

  rootmaster% nistbladm -r [Site=Emeryville],depts.wiz.com.  

However, you could not have removed the Sales entry by specifying only the Site column value (SanFran), because two entries have that same value (R&D and Sales):
NameSiteManager
R&DSanFrankuznetsov
SalesSanFranjhill
Manf-1Emeryvillehosteen
Manf-2Sausalitolincoln

Removing Multiple Entries From a Table

To remove multiple entries from a table, use the -R option:

  nistbladm -R indexedname  

As with the -r option, you can specify as few column values as you wish. Unlike the -r option, however, if NIS+ finds duplicates, it removes all of them. You can find the name of a table's column by using the niscat -o command. This example removes all entries in which the Site is SanFran:

  rootmaster% nistbladm -R [Site=SanFran],depts.wiz.com.  

NameSiteManager
Manf-1Emeryvillehosteen
Manf-2Sausalitolincoln
You can use the -R option to remove all the entries from a table. Simply do not specify any column values, as in this example:

  rootmaster% nistbladm -R [],depts.wiz.com.  

The niscat Command

The niscat command displays the contents of an NIS+ table. However, you can also use it to display the object properties of the table. You must have read rights to the table, entries, or columns that you wish to display.

Syntax

To display the contents of a table, use:

  niscat [-hM] tablename  

To display the object properties of a table, use:

  niscat -o tablename  
  niscat -o entry  

Table 11-3 niscat
OptionDescription
-hHeader. Displays a header line above the table entries, listing the name of each column.
-MMaster. Displays only the entries of the table stored on the Master server. This ensures you get the most up-to-date information and should be used only for debugging.
-oObject. Displays object information about the table, such as column names, properties, and servers.

Displaying the Contents of a Table

To display the contents of a table, use niscat with a table name:

  niscat tablename  

This example displays the contents of the table named depts.

  rootmaster% niscat -h depts.wiz.com.  
  #Name:Site:Manager  
  R&D:SanFran:kuznetsov  
  Sales:SanFran:jhill  
  Manf-1:Emeryville:hosteen  
  Manf-2:Sausalito:lincoln  


Note - The symbol *NP* indicates that you do not have permission to view that entry. Permissions are granted on a table, column, or entry (row) basis. For more on access permissions, see Chapter 7, "Administering NIS+ Access Rights."

Displaying the Object Properties of a Table or Entry

To list the object properties of a table us niscat -o and the table's name:

  niscat -o tablename.org_dir  

To display the object properties of a table entry, use niscat -o and specify the entry with an indexed name:

  entry ::=column=value ... tablename | [column=value,...],tablename  

Here are two examples, one for a table and one for a table entry:

  rootmaster# niscat -o hosts.org_dir.wiz.com.  
  Object Name   : hosts  
  Owner         : rootmaster.wiz.com.  
  Group         : admin.wiz.com.  
  Domain        : org_dir.wiz.com.  
  Access Rights : ----rmcdr---r---  
  Time to Live  : 12:0:0  
  Object Type   : TABLE  
  Table Type          : hosts_tbl  
  Number of Columns   : 4  
  Character Separator :  
  Search Path         :  
  Columns             :  
         [0]      Name         : cname  
                  Attributes   : (SEARCHABLE, TEXTUAL DATA, CASE INS  
                  Access Rights: ----------------  
         [1]      Name         : name  
                  Attributes   : (SEARCHABLE, TEXTUAL DATA, CASE INS  
                  Access Rights: ----------------  
         [2]      Name         : addr  
                  Attributes   : (SEARCHABLE, TEXTUAL DATA, CASE INS  
                  Access Rights: ----------------  
         [3]      Name         : comment  
                  Attributes   : (TEXTUAL DATA)  
                  Access Rights: ----------------  


  rootmaster# niscat -o [name=rootmaster],hosts.org_dir.wiz.com.  
  Object Name     : hosts  
  Owner           : rootmaster.wiz.com.  
  Group           : admin.wiz.com.  
  Domain          : org_dir.wiz.com.  
  Access Rights   : ----rmcdr---r---  
  Time to Live    : 12:0:0  
  Object Type     : ENTRY  
          Entry data of type hosts_tbl  
          Entry has 4 columns.  
          .  
          .  
          .  
  #  

The nismatch and nisgrep Commands

The nismatch and nisgrep commands search through NIS+ tables for entries that match a particular string or regular expression, respectively. They display either the entries themselves or a count of how many entries matched. The differences between the nismatch and nisgrep commands are highlighted in Table 11-4 below.
Table 11-4 nisgrepnismatch
Characteristicsnismatchnisgrep
Search criteriaAccepts text onlyAccepts regular expressions
SpeedFasterSlower
Searches throughSearchable columns onlyAll columns, whether searchable or not
Syntax of search criteriacolumn=string ... tablename [column=string,...],t ablenamecolumn=exp ... tablename
The tasks and examples in this section describe the syntax for both commands.
To use either command, you must have read access to the table you are searching through.
The examples in this section are based on the values in the following table, named depts.wiz.com. Only the first two columns are searchable.
Table 11-5
Name (S)Site (S)Manager
R&DSanFrankuznetsov
SalesSanFranjhill
Manf-1Emeryvillehosteen
Manf-2Sausalitolincoln
Shipping-1Emeryvilletsosulu
Shipping-2Sausalitokatabami
ServiceSparksfranklin

About Regular Expressions

Regular expressions are combinations of text and symbols that you can use to search for special configurations of column values. For example, the regular expression 'Hello' searches for a value that begins with Hello. When using a regular expression in the command line, be sure to enclose it in quotes, since many of the regular expression symbols have special meaning to the Bourne and C shells. For example:

  rootmaster% nisgrep -h greeting='Hello' phrases.wiz.com.  

The regular expression symbols are summarized in Table 11-6, below.
Table 11-6
SymbolDescription
^stringFind a value that begins with string.
string$Find a value that ends with string.
.Find a value that has a number characters equal to the number of periods.
[chars]Find a value that contains any of the characters in the brackets.
*exprFind a value that has zero or more matches of the expr.
+Find something that appears one or more times.
?Find any value.
\'s-char'Find a special character, such as ? or $.
x | yFind a character that is either x or y.

Syntax

To search through the first column, use:

  nismatch string tablename  
  nisgrep reg-exp tablename  

To search through a particular column, use:

  nismatch column=string tablename  
  nisgrep column=reg-exp tablename  

To search through multiple columns, use:

  nismatch column=string ... tablename  
  nismatch [column=string,...],tablename  
  nisgrep column=reg-exp ... tablename  

Table 11-7 nismatchnisgrep
OptionDescription
-cCount. Instead of the entries themselves, displays a count of the entries that matched the search criteria.
-hHeader. Displays a header line above the entries, listing the name of each column.
-MMaster. Displays only the entries of the table stored on the master server. This ensures you get the most up-to-date information and should be used only for debugging.

Searching the First Column

To search for a particular value in the first column of a table, simply enter the first column value and a tablename. In nismatch, the value must be a string. In nisgrep, the value must be a regular expression.

  nismatch [-h] string tablename  
  nisgrep [-h] reg-expression tablename  

Text Box(135x56)

This example searches through the depts table for all the entries whose first column has a value of R&D:

  rootmaster% nismatch -h 'R&D' depts.wiz.com.  
  rootmaster% nisgrep -h 'R&D' depts.wiz.com.  

Searching a Particular Column

To search through a particular column other than the first, use the following syntax:

  nismatch column=string tablename  
  nisgrep column=reg-expression tablename  

This example searches through the depts table for all the entries whose second column has a value of SanFran:

  rootmaster% nismatch -h Site=SanFran depts.wiz.com  
  rootmaster% nisgrep -h Site=SanFran depts.wiz.com  

Searching Multiple Columns

To search for entries with matches in two or more columns, use the following syntax:

  nismatch [-h] column=string ... tablename nismatch [-h] [column=string,...],tablename  
  nisgrep [-h] column=reg-exp ... tablename  

This example searches for entries whose second column has a value of SanFran and whose third column has a value of jhill:

  rootmaster% nismatch -h [Site=SanFran,Manager=jhill],  
  depts.wiz.com.  
  rootmaster% nisgrep -h Site=SanFran Manager=jhill depts.wiz.com.  

The nisln Command

The nisln command creates symbolic links between NIS+ objects and table entries. You can use it to link objects to objects or objects to table entries. (You cannot create a link that originates with a table entry.) All NIS+ administration commands accept the -L flag, which directs them to follow links between NIS+ objects.
To create a link to another object or entry, you must have modify rights to the source object; that is, the one that will point to the other object or entry.

CAUTION Caution - Never link a cred table. Each org_dir directory should have its own cred table. Do not use a link to some other org_dir cred table.

Syntax

To create a link, use:

  nisln source target  

Table 11-8 nisln
OptionDescription
-LFollow links. If the source is itself a link, the new link will not be linked to
it, but to that link's original source.
-DDefaults. Specify a different set of defaults for the linked object. Defaults are described in "Specifying Nondefault Security Values at Creation Time" on page 127.

Creating a Link

To create a link between objects, specify both object names: first the source, and then the target. To create links between objects and entries use indexed names.

  nisln source-object target-object  
  nisln [column=value,...],tablename target-object  

The nissetup Command

Text Box(144x84)

The nissetup command expands an existing NIS+ directory object into a domain by creating the org_dir and groups_dir directories, and a full set of NIS+ tables. It does not, however, populate the tables with data. For that, you will need the nisaddent command, described in "The nisaddent Command" on page 226. Expanding a directory into a domain is part of the process of setting up a domain.
The nissetup command can expand a directory into a domain that supports NIS clients as well.
To use nissetup, you must have modify rights to the directory under which you'll store the tables.

Syntax

To expand a directory into an NIS+ domain, use:

  /usr/lib/nis/nissetup  
  /usr/lib/nis/nissetup directory-name  

To expand a directory into an NIS-compatible NIS+ domain, use:

  /usr/lib/nis/nissetup -Y  
  /usr/lib/nis/nissetup -Y directory-name  

Expanding a Directory Into an NIS+ Domain

You can use the nissetup command with or without a directory name. If you don't supply the directory name, it uses the default directory. Each object that is added is listed in the output.

  rootmaster# /usr/lib/nis/nissetup wiz.com.  
  org_dir.wiz.com. created  
  groups_dir.wiz.com. created  
  auto_master.org_dir.wiz.com. created  
  auto_home.org_dir.wiz.com. created  
  bootparams.org_dir.wiz.com. created  
  cred.org_dir.wiz.com. created  
  ethers.org_dir.wiz.com. created  
  group.org_dir.wiz.com. created  
  hosts.org_dir.wiz.com. created  
  mail_aliases.org_dir.wiz.com. created  
  sendmailvars.org_dir.wiz.com. created  
  netmasks.org_dir.wiz.com. created  
  netgroup.org_dir.wiz.com. created  
  networks.org_dir.wiz.com. created  
  passwd.org_dir.wiz.com. created  
  protocols.org_dir.wiz.com. created  
  rpc.org_dir.wiz.com. created  
  services.org_dir.wiz.com. created  
  timezone.org_dir.wiz.com. created  

Expanding a Directory Into an NIS-Compatible Domain

To expand a directory into a domain that supports NIS+ and NIS client requests, use the -Y flag. The tables are created with read rights for the nobody class so that NIS clients requests can access them.

  rootmaster# /usr/lib/nis/nissetup -Y Test.wiz.com.  

The 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 NIS+ and DNS Setup and Configuration Guide. 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. Appendix C, "Information in NIS+ Tables," 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:
  • Entries that exist only in the source are added to the table
  • Entries that exist in both the source and the table are updated in the table
  • Entries that exist only in the NIS+ table are deleted from the table
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.

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 [domain]  
  /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  

Table 11-9 nisaddent
OptionDescription
-aAppend. Contents of the source are appended to contents of the table.
-rReplace. Contents of the source replace contents of the table.
-mMerge. Contents of the source are merged with contents of the table.
-dDump. Contents of the NIS+ table are dumped to stdout.
-vVerbose. The command prints verbose status messages.
-PFollow path. If the command was unable to find a table, follow the search paths specified in the environment variable NIS_PATH.
-AAll data. Apply the operation to all the tables in the search path.
-MMaster server. Use the tables only in the master server of the domain.
-DOverride defaults. For the new data being loaded into the tables, override existing defaults. For syntax, see "Specifying Nondefault Security Values at Creation Time" on page 127.

Loading Information From a File

You can transfer the contents of a file into an NIS+ table in several different ways:
  • The -f option with no other option replaces the contents of table-type in the local domain with the contents of filename.

  nisaddent -f filename table-type  

  • With the -a option, -f appends the contents of filename to table-type.

  nisaddent -a -f filename table-type  

  • With the -m option, -f merges the contents of filename into the contents of table-type.

  nisaddent -m -f filename table-type  

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 sales.wiz.com.  
  rootmaster# /usr/lib/nis/nisaddent -f /etc/shadow.xfr shadow sales.wiz.com.  


Note - When creating a NIS+ passwd table from /etc files, you must run nisaddent twice; once on the /etc/passwd file and once on the /etc/shadow file.

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.
Table 11-10catnisaddent
TaskCommand
Redirectcat filename > nisaddent table-type
Redirect with append optioncat filename > nisaddent -a table-type
Redirect with append into another domaincat filename > nisaddent -a table-type NIS+ domain
Pipecat filename | nisaddent table-type
Pipe with append optioncat filename | nisaddent -a table-type
If the NIS+ table is one of the automounter tables or a nonstandard table, add the -t option and the complete name of the NIS+ table.

  master# nisaddent -f /etc/auto_home.xfr -t auto_home.org_dir.wiz.com. key-value  
  
  master# nisaddent -f /etc/auto_home.xfr -t auto_home.org_dir.wiz.com. key-value sales.wiz.com.  

Loading Data From an NIS Map

Text Box(144x32)

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.
Table 11-11
NIS+ Table TypeNIS Map Name
Hostshosts.byaddr
Passwdpasswd.byname
Groupgroup.byaddr
Ethersethers.byname
Netmasksnetmasks.byaddr
Table 11-11
NIS+ Table TypeNIS Map Name
Networksnetworks.byname
Protocolsprotocols.byname
RPCrpc.bynumber
Servicesservices.byname
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-wiz domain:

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

This example does the same thing, but for the sales.wiz.com. domain instead of the local domain, wiz.com.

  rootmaster# /usr/lib/nis/nisaddent -y old-wiz passwd sales.wiz.com.  

If the NIS+ table is one of the automounter tables 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-wiz -t auto_home.org_dir.wiz.com. key-value  
  rootmaster# nisaddent -y old-wiz -t auto_home.org_dir.wiz.com. key-value sales.wiz.com.  

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 sales.wiz.com.  

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

  rootmaster# nisaddent -Y auto_home -t auto_home.org_dir.wiz.com. key-value  
  rootmaster# nisaddent -Y auto_home -t auto_home.org_dir.wiz.com. key-value sales.wiz.com.  

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:

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