This section provides instructions for using the NIS+ command set to populate NIS+ tables on a root or nonroot master server from either /etc files or NIS maps. This section also describes how to transfer information back from NIS+ tables to NIS maps, a procedure that may be required during a transition from NIS to NIS+. Finally, it includes two tasks that describe how to limit access to the passwd column of the passwd table:
Notes:
- Populate tables with the NIS+ installation scripts rather than with the NIS+ commands described in this section. This section should be used only by administrators who are very familiar with NIS+ and who require nonstandard features or configurations not provided by the installation scripts.
- When populating tables from maps or files, the tables should have already been created in the process of setting up a root or subdomain as explained in Setting Up the Root Domain and Setting Up a Nonroot Domain. Although you can populate a domain's tables at any time after they are created, it is recommended that you do so immediately after setting up the domain. This enables you to add clients more easily, because the required information about the clients should already be available in the domain's tables.
See Configuration Worksheets for worksheets that you can use to plan your NIS+ namespace.
When you populate a table--whether from a file or an NIS map--you can use any of the following options:
When updating a large table with a file or map whose contents are not vastly different from those of the table, the merge option can spare the server a great many operations. Because it 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. Therefore, this is the preferred option.
This task transfers the contents of an ASCII file, such as /etc/hosts, into an NIS+ table.
You can perform this task from any NIS+ client, including the root master server, as long as you have the appropriate credentials and access rights. If you are going to replace or merge the entries in the table with the entries from the text file, you must have create and destroy rights to the table. If you are going to append the new entries, you only need create rights.
Note: If you are not familiar with NIS+ security, review the security-related sections of this book before starting this procedure.
When this procedure is finished, the table entries are owned by the NIS+ principal that performed the operation and the group specified by the NIS_GROUP environment variable.
Before beginning the following procedure, ensure the following:
You need the name and location of the text files that will be transferred.
Use this working copy for the actual file transfer steps described in this section. Give each working copy the same file name extension (for example, .xfr).
rootmaster% cp /etc/hosts /etc/hosts.xfr
Perform this task from any NIS+ client, but ensure that the client belongs to the same domain as the tables into which you want to transfer the information. The examples in this task use the root master server. Since the administrator in these examples is logged on as root user, the NIS+ principal actually performing this operation (and therefore needing the proper credentials and access rights) is the root master server.
Because you will be using the /usr/lib/nis/nisaddent command once per table, adding its prefix to the search path eliminates having to type it each time.
rootmaster# PATH=$PATH:/usr/lib/nis rootmaster# export PATH
By default, nisaddent appends (-a) the file information to the table information. Use the -a option when populating the tables for the first time. To synchronize the NIS+ tables with NIS maps or /etc files, use the -m (merge) option. To replace content, use the -r option.
To append:
rootmaster# nisaddent -a -f filename table [domain]
To merge:
rootmaster# nisaddent -m -f filename table [domain]
To replace:
rootmaster# nisaddent -r -f filename table [domain]
where:
The following are some examples, entered from the root domain's master server. The source files are edited versions of the /etc files:
rootmaster# nisaddent -m -f /etc/hosts.xfr hosts rootmaster# nisaddent -m -f /etc/groups.xfr groups
If you perform this operation from a nonroot (subdomain) server, keep in mind that a non-root server belongs to the domain above the one it supports; therefore, it is a client of another domain. For example, the Sales.Wiz.Com. master server belongs to the Wiz.Com. domain. To populate tables in the Sales.Wiz.Com. domain from that master server, you would have to append the Sales.Wiz.Com. domain name to the nisaddent statement.
salesmaster# nisaddent -f /etc/hosts.xfr hosts Sales.Wiz.Com.
If you perform this operation as a client of the Sales.Wiz.Com. domain, you do not need to append the domain name to the syntax.
rootmaster# niscat group.org_dir root::0:root other::1:: bin::2:root,bin,daemon . . .
Note: Since the domain's cred table already stores some credentials, ensure those credentials are not overwritten by the contents of the publickey text file before you transfer it to the cred table. You can avoid overwriting by removing those credentials from the publickey text file. To do this for rootmaster, that line would be:
unix.rootmaster@Wiz.Com public-key:private-key
To transfer the contents of the publickey file to the cred table, use nisaddent with the -a option.
rootmaster# nisaddent -a -f /etc/publickey.xfr -t cred.org_dir publickey \ [domain]
Note, however, that this operation only transfers DES credentials into the cred table. You will still need to create their LOCAL credentials to the cred table.
rootmaster# nisaddent -f auto.master.xfr -t auto_master.org_dir key-value rootmaster# nisaddent -f auto.home.xfr -t auto_home.org_dir key-value
rootmaster# nisaddent -m -f /etc/passwd.xfr passwd
rootmaster# nisping -C org_dir Checkpointing replicas serving directory org_dir.Wiz.Com. : Master server is rootmaster.Wiz.Com. Last update occurred at July 14, 1994 Master server is rootmaster.Wiz.Com. checkpoint succeeded.
Attention: If you do not have enough swap space, the server cannot checkpoint properly, but it does not notify you. Verify the contents of a table with the niscat command. If you do not have enough swap space, the following error message displays:
can't list table: Server busy, Try Again.This message indicates that you do not have enough swap space. Increase the swap space and checkpoint the domain again.
This task transfers the contents of an NIS map into an NIS+ table.
You can perform this task from any NIS+ client as long as you (or root user on the client) have the appropriate credentials and access rights. If you are going to replace or merge the entries in the table with the entries from the NIS map, you must have create and destroy rights to the table. If you are going to append the new entries, you only need create rights.
After you complete this operation, the table entries will be owned by the NIS+ principal that performed the operation (either you or, if logged on as root user, the client) and the group specified by the NIS_GROUP environment variable.
Before you begin the following procedure, ensure the following:
You need the name and location of the NIS maps.
The following procedure transfers the contents of an NIS map into an NIS+ table.
rootmaster# PATH=$PATH:/usr/lib/nis rootmaster# export PATH
By default, nisaddent appends (-a) the file information to the table information. Use the -a option when populating the tables for the first time. To synchronize the NIS+ tables with NIS maps or /etc files, use the -m (merge) option. To replace content, use the -r option.
To append:
rootmaster# nisaddent -a -y nisdomain table
To merge:
rootmaster# nisaddent -m -y nisdomain table
To replace:
rootmaster# nisaddent -r -y nisdomain table
where:
The following are some examples:
rootmaster# nisaddent -m -y oldwiz hosts rootmaster# nisaddent -m -y oldwiz passwd rootmaster# nisaddent -m -y oldwiz groups
The first example transfers the contents of the hosts.byname and hosts.byaddr maps in the oldwiz (NIS) domain to the NIS+ hosts table in the root domain (NIS+). The second transfers the NIS maps that store password-related information into the NIS+ passwd table. The third does the same with group-related information.
rootmaster# makedbm -u /var/yp/oldwiz/publickey.byname /etc/publickey.xfr rootmaster# vi /tmp/publickey.tmp
unix.rootmaster@Wiz.Com public-key:private-key
rootmaster# nisaddent -a -f /etc/publickey.xfr -t cred.org_dir Publickey
This operation transfers only DES credentials into the cred table. You must still create their local credentials to the cred table.
rootmaster# nisaddent -y oldwiz -Y auto.master -t auto_master.org_dir key-value rootmaster# nisaddent -y oldwiz -Y auto.home -t auto_home.org_dir key-value
where:
rootmaster# nisping -C org_dir Checkpointing replicas serving directory org_dir.Wiz.Com. : Master server is rootmaster.Wiz.Com. Last update occurred at July 14, 1994 Master server is rootmaster.Wiz.Com. checkpoint succeeded.
Attention: If you do not have enough swap space, the server cannot checkpoint properly, but it does not notify you. Verify the contents of a table with the niscat command. If you do not have enough swap space, the following error message displays:
can't list table: Server busy, Try Again.This message indicates that you do not have enough swap space. Increase the swap space and checkpoint the domain again.
This task transfers the contents of NIS+ tables into the NIS maps on an NIS master server.
To perform this task, you must have read access to each table whose contents you transfer.
The maps must have already been built on the NIS server.
The following procedure transfers the contents of NIS+ tables into the NIS master server maps:
Use the nisaddent command with the -d option, once for each table.
dualserver% /usr/lib/nis/nisaddent -d -t table tabletype > filename
The -d option transfers the contents of table to filename, converting the contents back to standard /etc file format.
The NIS+ output files are ASCII files that you can use as input files for the NIS maps. Copy them into the NIS master's /etc directory, and then use the make command.
dualserver# cd /var/yp dualserver# make
This task describes how to limit read access to the password-related columns of the passwd table to only the entry owner and the table administrators without affecting the read access of other authenticated principals (including applications) to the remaining columns of the passwd table.
This task establishes the following rights:
Nobody Owner Group World Table Level Rights : ---- rmcd rmcd ---- Passwd Column Rights : ---- rm-- rmcd ---- Shadow Column Rights : ---- rm-- rmcd ----
Before beginning the following procedure, ensure the following:
This task assumes the existing permissions are:
Access Rights : ----rmcdrmcdr--- Columns : [0] Name : name Access Rights : r-----------r--- [1] Name : passwd Access Rights : -----m---------- [2] Name : uid Access Rights : r-----------r--- [3] Name : gid Access Rights : r-----------r--- [4] Name : gcos Access Rights : r----m------r--- [5] Name : home Access Rights : r-----------r--- [6] Name : shell Access Rights : r-----------r--- [7] Name : shadow Access Rights : r-----------r---
If your permissions are different, you may need to use a different syntax than the one shown in this procedure's examples. For instructions, see Administering NIS+ Access Rights.
The following procedure limits read access to the content of the passwd table.
rootmaster# niscat -o passwd.org_dir
rootmaster# nischmod og=rmcd,nw= passwd.org_dir
passwd ---- rm-- ---- ---- shadow ---- r--- ---- ----
rootmaster# nistbladm -u passwd=o+r, shadow=o+r passwd.org_dir
The following table shows a summary of the steps required to populate NIS+
tables. Entries in the table below are simplified. Refer to the
more thorough task descriptions for options, exceptions, and messages.
Transferring NIS Files Into NIS+ Tables: Command Summary | |
---|---|
Tasks | Commands |
Log in to an NIS+ client. |
rootmaster% |
Create working copies of the files to be transferred. |
cp /etc/hosts /etc/hosts.xfr . . . |
Add /usr/lib/nis to search path. |
PATH=$PATH:/usr/lib/nis; export PATH |
Transfer each file, one at a time. |
nisaddent -m -f /etc/hosts.xfr hosts . . |
Remove old server credentials from publickey file. |
vi /etc/publickey.xfr . . . |
Transfer it to the cred table. |
nisaddent -a -f /etc/publickey.xfr cred |
Transfer the automounter files. |
nisaddent -f auto.master.xfr \ -t auto_master.org_dir key-value nisaddent -f auto.home.xfr \ -t auto_home.org_dir key-value |
Checkpoint the table directory. |
nisping -C org_dir |
Transferring NIS Maps Into NIS+ Tables: Command Summary | |
---|---|
Tasks | Commands |
Log in to an NIS+ client. |
rootmaster% |
Add /usr/lib/nis to search path. |
PATH=$PATH:/usr/lib/nis; export PATH |
Transfer each map, one at a time. |
nisaddent -m -y oldwiz hosts . . . |
Dump publickey map to a file. |
makedbm \ -u /var/yp/oldwiz/publickey.byname \ > /etc/publickey.xfr |
Remove new credentials. |
vi /etc/publickey.xfr . . . |
Transfer the publickey file. |
nisaddent -a -f /etc/publickey.xfr \ -t cred.org_dir publickey |
Transfer the automounter maps. |
nisaddent -y oldwiz \ -Y auto.master \ -t auto_master.org_dir key-value nisaddent -y oldwiz \ -Y auto.home \ -t auto_home.org_dir key-value |
Checkpoint the table directory. |
nisping -C org_dir |
Transferring NIS+ Tables to NIS Maps: Command Summary | |
---|---|
Tasks | Commands |
Log in to NIS+ server. |
dualserver% |
Transfer NIS+ tables to files. |
/usr/lib/nis/nisaddent \ -d [-t table] tabletype \ > filename . . . |
Transfer files to NIS maps. |
makedbm flags output-file NIS-dbm-file |
Limiting Access to Passwd Column: Command Summary | |
---|---|
Tasks | Commands |
Log into the domain's master server. |
rootmaster# |
Check the table's existing rights. |
niscat -o passwd.org_dir |
Assign the table new rights. |
nischmod og=rmcd,nw= passwd.org_dir |
Assign the columns new rights |
nistbladm -u passwd=o+r, shadow=n+r \ passwd.org_dir |
Verify the new rights. |
niscat -o passwd.org_dir |