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. |
When creating an NIS+ passwd table from /etc files, you must run nisaddent twice; once on the /etc/passwd file and once on the /etc/shadow file.
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 -m -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.
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 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. |