Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
19.  Administering NIS+ Tables The nistbladm Command nistbladm, Searchable Columns, Keys, and Column Values  Previous   Contents   Next 
   
 

nistbladm and Indexed Names

In the context of table administration, an NIS+ indexed name is a name that combines a table name with column value search criteria to identify and select particular entries in a table. Indexed names use the format:

[search_criteria],tablename.directory

Note that search_criteria must be enclosed in square brackets [ ]. The search_criteria use the format:

columname=value, \
 columname=value,...

Where columname=value pairs are column values from the table's searchable columns as described in "nistbladm and Column Values".

For example, to identify the altair entry in Table 19-2 you could use the indexed name:

[addr=129.146.168.4,cname=altair],hosts.org_dir.doc.com.

The nistbladm -R command allows you to remove all the entries in a table by using the two square brackets with nothing between them [ ] as a wildcard specifying all table rows.

nistbladm and Groups

In a Solaris-NIS+ environment, there are three types of groups:

  • UNIX groups. Information about UNIX groups is stored in the groups.org_dir table. Use nistbladm to administer UNIX group information.

  • Netgroups. Information about net groups is stored in the netgroups.org_dir table. Use nistbladm to administer net group information.

  • NIS+ groups. Information about NIS+ groups is stored in one or more tables in the groups_dir directory object. Use nisgrpadm to administer NIS+ group information.


Note - Do not use nistbladm to administer NIS+ groups.


(See "Solaris Groups" for more information on the different types of groups and how to work with them.)

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 tabletype columnspec \
 ... tablename

Where:

  • Tabletype is simply a name that identifies a class of tables to which this table belongs. You can use any name you choose.

  • A columnspec specifies the name and characteristics of each column in a new table. Enter one columnspec for each column you want in your new table. Separate the columnspecs with spaces:

 nistbladm -c tabletype columnspec columnspec \
 columnspec tablename

Columnspec formats are described in "Specifying Table Columns", below.

Specifying Table Columns

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

name=type,rights:

Table 19-3 Table Column Components

Component

Description

name

Name 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 19-4). This component is optional. 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".

A column can be one of the following types:

Table 19-4 Table Column Types

Type

Description

 

No column type specified after the = sign. The column is neither searchable nor encrypted.

S

Searchable.

I

Searchable, but case-insensitive. When NIS+ commands search through the column, they will ignore case.

C

Encrypted.

NIS+ commands search through the column and identify individual table rows based on the contents of the searchable columns. Searchable columns are designated with either the S or the I option. In database terminology, a searchable column is a key. The first column in each table must be searchable. The remaining columns do not have to be searchable. Because the table is keyed on the searchable columns, if you have more than one searchable column, they must be the first and subsequent columns and not skip any columns. For example, if only one column in a table is searchable, it has to be the first column. If two columns are searchable, they must be the first two columns. (See "nistbladm, Searchable Columns, Keys, and Column Values" for more information on searchable columns.)

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.

In the example below, a 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 Name=C \
 divs.mydir.doc.com.

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


Note - NIS+ assumes that all column entries are null terminated. Applications and routines that write information to NIS+ tables must be configured to null terminate each column entry.


Creating Additional Automount Table

If you are creating an automount table, the table can have only two columns. The first column must be named key and the second column must be named value. For example, to create an automount table named auto1, you would enter:

master% nistbladm -c key-value key=S value= auto1.org_dir.doc.com.

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 Table Entries"). This example deletes the divs table from the doc.com. directory:

rootmaster% nistbladm -d divs.doc.com.

Adding Entries to a Table

To add new entries (rows) to a table, use nistbladm with either the -a or -A options followed by either one or more column=value pairs and the table name or an indexed name as described in "nistbladm and Indexed Names".

nistbladm [-a | -A] indexedname
nistbladm [-a | -A] column="value" \
column="value" \
... tablename

When adding new entry rows to a table with either -a or -A:

  • Always enclose the value element in quotes. For example, to add an entry where the value of the cname column is deneb, the column=value pair would look like: cname="deneb"

  • You must specify a value for every column in the table.

  • To specify that a column in the entry row you are adding is empty use column=" ". In other words, for the value, enclose a space between the quote marks.


Note - NIS+ is a naming service and its tables are designed to store references to objects, not the objects themselves. NIS+ is optimized to support 10,000 objects with a combined total size of all tables not more than 10M bytes. NIS+ does not support individual tables where the sum of field sizes in a single column are greater than approximately 7k. If a table is too large, rpc.nisd may fail.


Adding a Table Entry With the -a Option

The -a option adds an entry to a table unless the entry already exists, in which case it returns an error. An entry is defined as existing if its values in the searchable columns exactly match the values in the new entry's searchable columns. (The values in non-searchable columns are not taken into account.)

To use the -a option, you must specify a value for every column in the table:

nistbladm -a column="value" \
 column="value" \
 ... tablename
nistbladm -a indexedname

(To list the names and characteristics of table columns, use the niscat -o tablename command.)

For example, to add a new row to a table named depts using column=value pairs, you would enter:

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

To add the same entry using an indexed name, you would enter:

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

Both examples would produce a table row that looked like this:

Dept

Site

Name

R&D

SanFran

vattel

C-shell users should also use quotes to set off expressions using square brackets.

You can only add one entry with each instance of the nistbladm command. You must run nistbladm once for each entry row you want to add.

If a table row already exists with values in each column that are identical to the entry you are trying to create, nistbladm -a will return an error. You cannot have two identical entry rows in a table. In this context, rows are considered identical if the values in the searchable columns are identical, the values in none search able columns are not considered.

For example, if the Dept and Site columns are searchable, and the Name column is not searchable, nistbladm considers the following two rows to be identical:

Dept (searchable)

Site (searchable)

Name (not searchable)

Sales

Vancouver

Hosteen

Sales

Vancouver

Lincoln

 
 
 
  Previous   Contents   Next