Skip Navigation Links | |
Exit Print View | |
System Administration Guide: Naming and Directory Services (NIS+) |
Part I About Naming and Directory Services
Part II NIS+ Setup and Configuration
4. Configuring NIS+ With Scripts
5. Setting Up the NIS+ Root Domain
8. Configuring an NIS+ Non-Root Domain
10. NIS+ Tables and Information
12. Administering NIS+ Credentials
14. Administering Enhanced NIS+ Security Credentials
15. Administering NIS+ Access Rights
16. Administering NIS+ Passwords
18. Administering NIS+ Directories
Using the nistbladm Command With NIS+ Tables
nistbladm and NIS+ Column Values
nistbladm, Searchable NIS+ Columns, Keys, and Column Values
nistbladm and Indexed NIS+ Names
Creating Additional NIS+ Automount Tables
Adding Entries to an NIS+ Table
Adding an NIS+ Table Entry With the -a Option
Adding an NIS+ Table Entry With the -A Option
Editing an NIS+ Table Entry With the -e Option
Editing an NIS+ Table Entry With the -E Option
Removing NIS+ Single Table Entries
Removing Multiple Entries From an NIS+ Table
Displaying the Contents of an NIS+ Table
Displaying the Object Properties of an NIS+ Table or Entry
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+
Expanding a Directory Into an NIS+ Domain
Expanding a Directory Into an NIS-Compatible Domain
20. NIS+ Server Use Customization
23. Information in NIS+ Tables
Common NIS+ Namespace Error Messages
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 Populating NIS+ Tables. 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. Chapter 10, NIS+ Tables and Information 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.
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
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.doc.com. rootmaster# /usr/lib/nis/nisaddent -f /etc/shadow.xfr shadow sales.doc.com.
Note - When creating an NIS+ passwd table from /etc files, you must run nisaddent twice. You run the command once on the /etc/passwd file and once on the /etc/shadow file.
Note - On a system that is running a release prior to the Solaris 10 7/07 release, you must place IPv6 addresses into NIS+. To merge entries from the /etc/inet/ipnodes file (IPv6 addresses) into the ipnodes.org_dir table, use the -v and -f options.
rootmaster# /usr/lib/nis/nisaddent -mv -f /etc/inet/ipnodes ipnodes
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.
|
If the NIS+ table is an automounter table 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.doc.com.key-value master# nisaddent -f /etc/auto_home.xfr \ -t auto_home.org_dir.doc.com. key-value sales.doc.com.
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. Note that /var/yp/nisdomain must be local files.
|
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-doc domain:
rootmaster# /usr/lib/nis/nisaddent -y old-doc passwd
This example does the same thing, but for the sales.doc.com. domain instead of the local domain, doc.com.
rootmaster# /usr/lib/nis/nisaddent -y old-doc passwd sales.doc.com.
If the NIS+ table is an automounter table 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-doc \ -t auto_home.org_dir.doc.com. key-value rootmaster# nisaddent -y old-doc \ -t auto_home.org_dir.doc.com. key-value sales.doc.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.doc.com.
If the NIS map is an automounter map or a non standard map, combine the -Y option with the -t option:
rootmaster# nisaddent -Y auto_home -t auto_home.org_dir.doc.com. key-value rootmaster# nisaddent -Y auto_home -t auto_home.org_dir.doc.com. key-value sales.doc.com.
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:
rootmaster# nisaddent -d auto_home -t auto_home.org_dir.doc.com. key-value rootmaster# nisaddent -d auto_home -t auto_home.org_dir.doc.com. key-value sales.doc.com.