Administering NIS+ Tables
This chapter describes NIS+ tables and how to administer them. (See Table 10-1, for detailed descriptions of the default NIS+ tables.)
Note - NIS+ might not be supported in a future release. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment (see Part V). For more information, visit http://www.sun.com/directory/nisplus/transition.html.
NIS+ Tables
Information used by NIS+ is stored in NIS+ tables. (See Chapter 23, Information in NIS+ Tables for a description of each default NIS+ system tables supplied in Solaris operating environment.)
For a complete description of NIS+ table-related commands and their syntax and options, see the NIS+ man pages.
The nistbladm Command
Note - Some NIS+ table administration tasks can be performed more easily with Solstice AdminSuite tools if you have them available.
The nistbladm command is the primary NIS+ table administration command. The nistbladm command is for use on NIS+ tables stored in an NIS+ directory object. 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.
nistbladm Syntax Summary
The general syntax of the nistbladm command is:
nistbladm options \ [columspec | columnvalue] \ [tablename | indexedname] |
Where:
columnspec is a specification defining a column to be created in a table as described in "Specifying Table Columns".
columnvalue identifies a particular cell value in the table identified by tablename as described in "nistbladm and Column Values".
tablename is the name of the table. For example, hosts.org_dir.doc.com.
indexedname identifies a particular cell value in a certain table as described in "nistbladm and Column Values". In essence indexedname is the equivalent of columnvalue plus tablename.
Table 19-1 nistbladm Options
Option | Description |
---|---|
-a | -A | Add an entry to an existing NIS+ table. The -a option returns an error if execution of the command would result in overwritting any existing entry. The -A option forces execution of the command even if it results in overwriting an existing entry. (See "Adding Entries to a Table".) |
-D defaults | Specify a different set of default properties when creating an object. (See the nistbladm man page for details.) |
-d | Destroy a table. (See "Deleting a Table".) |
-c | Create a table. (See "Creating a New Table".) |
-r | -R | Remove one or more entries from an existing NIS+ table. The -r option returns an error if execution of the command would result in removal of more than one entry. The -R option forces execution of the command even if it results in removing multiple entries. (See "Removing Table Entries".) |
-m | An obsoleted option for modifying table entries that is still supported for backwards compatibility. The -e and -E options are the preferred method for editing entries. |
-e | -E | Edit an entry in an existing NIS+ table. The -e option returns an error if execution of the command would affect more than one entry. The -A option forces execution of the command even if it results in changing an existing entry in such a way as to overwrite a different entry. (See "Modifying Table Entries".) |
nistbladm and Column Values
Column values are used to identify individual entries in tables using the format:
columname="value", \ columnname="value", ... |
Where:
columname is the name of a table column.
value is the contents of a particular cell within a column. That value is what identifies a table row. (When using column=value to create or modify table data, always enclose the value element in quotes.)
For example, suppose you had a hosts table that listed machine names and IP addresses:
Table 19-2 Example Hosts Table
IP address | name | aliases |
---|---|---|
129.146.168.4 | altair | |
129.146.168.119 | deneb | |
129.146.168.120 | regulus | dnsmaster |
129.146.168.121 | regulus | dnsmaster |
129.146.168.11 | sirius |
In this example, your could identify the altair entry (row) in three different ways using the column=value of:
name=altair
address=129.146.168.4
name=altair,address=129.146.168.4.
But notice in the table above that the machine regulus is multi-homed and has two IP addresses. In that case, the column=value of host=regulus identifies two rows. To identify just the first regulus row, you would enter either:
address=129.146.168.120 or
address=129.146.168.120.,name=regulus,dnsmaster
Note - Some nistbladm operations require that you enter a column=value pair for every column in the table.
nistbladm, Searchable Columns, Keys, and Column Values
When an NIS+ table is created, one or more columns are designated searchable with either the S or the I flags as described in "Specifying Table Columns". You can use the niscat -o tablename command to display a list of a table's columns and their characteristics.
A table is keyed on its searchable columns. This means that each row in the table must have a unique combination of values in the searchable columns. For example, if a table has one searchable column, each table row must have a unique value in that column, no two rows can contain the same value.
For example, suppose you had a table containing one searchable column named city and a non-searchable column named country. The following rows would all be permitted:
City | Country |
---|---|
San Francisco | United States |
Santa Fe | United States |
Santiago | Chile |
But you could not have two rows like:
City | Country |
---|---|
London | Canada |
London | England |
If a table has multiple searchable columns, it is the combination of values that must be unique. For example, suppose you had a table containing two searchable columns, Lastname, Firstname and a non-searchable column named city. The following rows would all be permitted:
Lastname | Firstname | City |
---|---|---|
Kuznetsov | Sergei | Odessa |
Kuznetsov | Rima | Odessa |
Sergei | Alex | Odessa |
But you could not have two rows like this:
Lastname | Firstname | City |
---|---|---|
Kuznetsov | Rima | Odessa |
Kuznetsov | Rima | Chelm |
NIS+ commands use the values in the searchable columns to identify specific table rows.