JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Naming and Directory Services (NIS+)
search filter icon
search icon

Document Information

Preface

Part I About Naming and Directory Services

1.  Name Service Switch

Part II NIS+ Setup and Configuration

2.  NIS+: An Introduction

3.  NIS+ Setup Scripts

4.  Configuring NIS+ With Scripts

5.  Setting Up the NIS+ Root Domain

6.  Configuring NIS+ Clients

7.  Configuring NIS+ Servers

8.  Configuring an NIS+ Non-Root Domain

9.  Setting Up NIS+ Tables

Part III NIS+ Administration

10.  NIS+ Tables and Information

11.  NIS+ Security Overview

12.  Administering NIS+ Credentials

13.  Administering NIS+ Keys

14.  Administering Enhanced NIS+ Security Credentials

15.  Administering NIS+ Access Rights

16.  Administering NIS+ Passwords

17.  Administering NIS+ Groups

18.  Administering NIS+ Directories

19.  Administering NIS+ Tables

NIS+ Table Administration

Using the nistbladm Command With NIS+ Tables

nistbladm Syntax Summary

nistbladm and NIS+ Column Values

nistbladm, Searchable NIS+ Columns, Keys, and Column Values

nistbladm and Indexed NIS+ Names

nistbladm and NIS+ Groups

Creating a New NIS+ Table

Specifying NIS+ Table Columns

Creating Additional NIS+ Automount Tables

Deleting an NIS+ Table

Adding Entries to an NIS+ Table

Adding an NIS+ Table Entry With the -a Option

Adding an NIS+ Table Entry With the -A Option

Modifying NIS+ Table Entries

Editing an NIS+ Table Entry With the -e Option

Editing an NIS+ Table Entry With the -E Option

Removing NIS+ Table Entries

Removing NIS+ Single Table Entries

Removing Multiple Entries From an NIS+ Table

niscat Command

niscat Command Syntax

Displaying the Contents of an NIS+ Table

Displaying the Object Properties of an NIS+ Table or Entry

nismatch and nisgrep Commands

About Regular Expressions in NIS+

nismatch and nisgrep Command Syntax

Searching the First Column in NIS+

Searching a Particular Column in NIS+

Searching Multiple Columns in NIS+

nisln Command

nisln Command Syntax

Creating a Link in NIS+

nissetup Command

Expanding a Directory Into an NIS+ Domain

Expanding a Directory Into an NIS-Compatible Domain

nisaddent Command

nisaddent Command Syntax

Loading Information Into NIS+ From a File

Loading Data From an NIS Map Into NIS+

Dumping the Contents of an NIS+ Table to a File

20.  NIS+ Server Use Customization

21.  NIS+ Backup and Restore

22.  Removing NIS+

23.  Information in NIS+ Tables

24.  NIS+ Troubleshooting

A.  NIS+ Error Messages

About NIS+ Error Messages

Common NIS+ Namespace Error Messages

B.  Updates to NIS+ During the Solaris 10 Release

Solaris 10 and NIS+

Glossary

Index

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 19-6 below.

Table 19-6 Characteristics of nismatch and nisgrep

Characteristics
nismatch
nisgrep
Search criteria
Accepts text only
Accepts regular expressions
Speed
Faster
Slower
Searches through
Searchable columns only
All columns, whether searchable or not
Syntax of search criteria
column=string ... tablename[ column= string,...], tablename
column=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.doc.com. Only the first two columns are searchable.

Name (S)
Site (S)
Name
R&D
SanFran
kuznetsov
Sales
SanFran
jhill
Manf-1
Emeryville
hosteen
Manf-2
Sausalito
lincoln
Shipping-1
Emeryville
tsosulu
Shipping-2
Sausalito
katabami
Service
Sparks
franklin

About Regular Expressions in NIS+

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.doc.com.

The regular expression symbols are summarized in Table 19-7, below.

Table 19-7 Regular Expression Symbols in NIS+

Symbol
Description
^string
Find 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.
*expr
Find 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 | y
Find a character that is either x or y.

nismatch and nisgrep Command 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 19-8 nismatch and nisgrep Options

Option
Description
-c
Count. Instead of the entries themselves, displays a count of the entries that matched the search criteria.
-h
Header. Displays a header line above the entries, listing the name of each column.
-M
Master. 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 in NIS+

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

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.doc.com.
rootmaster% nisgrep -h `R&D' depts.doc.com.

Note - Quotes are used in the 'R&D' expression above to prevent the shell from interpreting the ampersand (&) as a metacharacter.


Searching a Particular Column in NIS+

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.doc.com.
rootmaster% nisgrep -h Site=SanFran depts.doc.com.

Searching Multiple Columns in NIS+

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

nismatch [-h] [column=string, ... \
 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,Name=jhill], depts.doc.com.
rootmaster% nisgrep -h Site=SanFran Name=jhill depts.doc.com.