This section describes how the following topics:
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.
To create a table, use:
nistbladm -c table-type columnspec...tablename
To delete a table, use:
nistbladm -d tablename columnspec ::= column=[CSI,rights]
To add entries, use:
nistbladm -a nistbladm -A entry
To modify entries, use:
nistbladm -m new-entry old-entry
To remove entries, use:
nistbladm -r nistbladm -R [entry or table] entry::=column=value ... tablename [column=value,...],tablename
The columnspec syntax is explained in the command description for nistbladm.
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.
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
niscat Syntax Options | |
---|---|
Option | Description |
-h | Header. Displays a header line above the table 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. |
-o | Object. Displays object information about the table, such as column names, properties, and servers. |
For more information, see the command description for niscat.
The nismatch and
nisgrep commands search NIS+ tables for entries that match a
particular string or regular expression, respectively. They display
either the entries themselves or only a count of how many entries
matched. The differences between the nismatch and
nisgrep commands are highlighted in the following table.
Comparison of nisgrep and nismatch | ||
---|---|---|
Characteristics | nismatch | nisgrep |
Search criteria | Accepts text only | Accepts regular expressions |
Speed | Faster than nisgrep | Slower than nismatch |
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.wiz.com. Only the first two columns
are searchable.
Example Table for depts.wiz.com. Domain | ||
---|---|---|
Name (searchable) | Site (searchable) | Manager |
R&D | Austin | stclair |
Sales | Austin | jbrown |
Manf-1 | Denver | cantera |
Manf-2 | Atlanta | dillard |
Shipping-1 | Denver | hsaio |
Shipping-2 | Atlanta | velez |
Service | Sacremento | mchenry |
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:
rootmaster% nisgrep -h greeting='Hello' phrases.wiz.com.
The regular expression symbols are summarized in the following table:
Regular Expression Symbols | |
---|---|
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. |
The following are three examples using regular expressions:
nismatch string tablename nisgrep reg-exp tablename
nismatch column=string tablename nisgrep column=reg-exp tablename
nismatch column=string ... tablename nismatch [column=string,...],tablename nisgrep column=reg-exp ... tablename
nismatch and nisgrep Syntax 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. |
To search for a particular value in the first column of a table, 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.wiz.com. rootmaster% nisgrep -h 'R&D' depts.wiz.com.
Note that quotes are used around the R&D expression to prevent the shell from interpreting the ampersand (&) as a meta character.
To search through a particular column other than the first, use:
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 Austin:
rootmaster% nismatch -h Site=Austin depts.wiz.com rootmaster% nisgrep -h Site=Austin depts.wiz.com
To search for entries with matches in two or more columns, use:
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 Austin and whose third column has a value of jbrown:
rootmaster% nismatch -h [Site=Austin,Manager=jbrown], depts.wiz.com. rootmaster% nisgrep -h Site=Austin Manager=jbrown depts.wiz.com.
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.
Attention: 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. NIS+ cannot operate correctly with linked cred tables.
To create a link, use:
nisln source target
The following table provides details about the nisln command
options.
nisln Syntax Options | |
---|---|
Option | Description |
-L | Follow links. If the source is itself a link, the new link will not be linked to it, but to that link's original source. |
-D | Defaults. Specify a different set of defaults for the linked object. Defaults are described in Specifying Nondefault Security Values. |
For more information, see the command description for nisln.
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, use the nisaddent command. 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 will store the tables.
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
For more information, see the command description for nissetup.
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.
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. Make sure that the information in the file is formatted properly. Appendix A, 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:
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.
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
Another way to load information from files 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.
The following table provides more information.
Using cat with nisaddent | |
---|---|
Task | Command |
Redirect |
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 |
Pipe |
cat filename | nisaddent table-type |
Pipe with append option |
cat 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. For example:
nisaddent -f /etc/auto_home.xfr \ -t auto_home.org_dir.wiz.com. key-value
nisaddent -f /etc/auto_home.xfr \ -t auto_home.org_dir.wiz.com. key-value \ sales.wiz.com. |
nisaddent Syntax Options | |
---|---|
Option | Description |
-a | Append. Contents of the source are appended to contents of the table. |
-r | Replace. Contents of the source replace contents of the table. |
-m | Merge. Contents of the source are merged with contents of the table. |
-d | Dump. Contents of the NIS+ table are dumped to stdout. |
-v | Verbose. The command prints verbose status messages. |
-P | Follow path. If the command was unable to find a table, follow the search paths specified in the environment variable NIS_PATH. |
-A | All data. Apply the operation to all the tables in the search path. |
-M | Master server. Use the tables only in the master server of the domain. |
-D | Override defaults. For the new data being loaded into the tables, override existing defaults. |
For more information, see the command description for nisaddent.