ypxfr Command

Purpose

Transfers a Network Information Services (NIS) map from an NIS server to a local host.

Syntax

/usr/sbin/ypxfr [ -f ] [ -c ] [ -d Domain ] [ -h Host ] [ -s Domain ] [  -C TID Program IPAddress Port ] [  -S ] MapName

Description

The ypxfr command transfers a Network Information Services (NIS) map from an NIS server to the local host as follows:

  1. Creates a temporary map in the /var/yp/Domain directory (which must already exist) on the client.
  2. Fetches the map entries from the server and fills in the map on the client, one at a time.
  3. Gets and loads the map parameters (order number and server).
  4. Deletes any old versions of the map.
  5. Moves the temporary map to the real map name.

If the /var/yp/securenets file exists, the ypxfr command only responds to hosts that are listed in this file.

The MapName variable specifies the name of a map that will be transferred from an NIS server.

If run interactively, the ypxfr command sends output to the user's terminal. If invoked without a controlling terminal, the ypxfr command appends its output to the /var/yp/ypxfr.log file (if the file already exists). This file records each transfer attempt and its results. The ypxfr command is most often invoked from the root user's crontab file or by the ypserv daemon.

To maintain consistent information between servers, use the ypxfr command to update every map in the NIS database periodically. Be aware though that some maps change more frequently than others and therefore need to be updated more frequently. For instance, maps that change infrequently, such as every few months, should be updated at least once a month. Maps that change frequently, such as several times a day, should be checked hourly for updates. The services.byname map, for example, may not change for months at a time, while the hosts.byname map may change several times a day.

To perform periodic updates automatically, use a crontab entry. To update several maps at one time, group commands together in a shell script. Examples of a shell script can be found in the /usr/etc/yp directory in the following files: ypxfr_1perday, ypxfr_2perday, ypxfr_1perhour.

You can use the System management interface tool (SMIT) to run this command. To use SMIT, enter:

smit ypxfr

Flags

Item Description
-C TID Program IPAddress Port Tells the ypxfr command where to find the yppush command. The ypserv daemon invokes the ypxfr command to call back a yppush command to the host. Use the parameters to indicate the following:
TID
Specifies the transaction ID of the yppush command.
Program
Specifies the program number associated with the yppush command.
IPAddress
Specifies the Internet Protocol address of the port where the yppush command resides.
Port
Specifies the port that the yppush command is listening on.
Note: This option is only for use by the ypserv daemon.
-c Prevents sending of a request to Clear Current Map to the local ypserv daemon. Use this flag if the ypserv daemon is not running locally at the time you are running the ypxfr command. Otherwise, the ypxfr command displays an error message and the transfer fails.
-d Domain Specifies a domain other than the default domain. The maps for the specified domain must exist.
-f Forces the transfer to occur even if the version at the master is not more recent than the local version.
-h Host Gets the map from host specified, regardless of what the map says the master is. If a host is not specified, the ypxfr command asks the NIS service for the name of the master and tries to get the map from there. The Host variable can contain a name or an Internet address in the form a.b.c.d.
-S Requires the ypserv server, from which it obtains the maps to be transferred, use privileged IP ports. Because only root user processes are typically allowed to use privileged ports, this feature adds an extra measure of security to the transfer. If the map being transferred is a secure map, the ypxfr command sets the permissions on the map to 0600.
-s Domain Specifies a source domain from which to transfer a map that should be the same across domains (such as the services.byname map).

Examples

To get a map from a host in another domain, enter:

/usr/sbin/ypxfr -d ibm -h venus passwd.byname

In this example, the ypxfr command gets the passwd.byname map from the host name venus in the ibm domain.

Files

Item Description
/var/yp/ypxfr.log Contains the log file.
/usr/sbin/ypxfr_1perday Contains the script to run one transfer each day, for use with the cron daemons.
/usr/sbin/ypxfr_2perday Contains the script to run two transfers each day.
/usr/sbin/ypxfr_1perhour Contains the script for hourly transfers of volatile maps.