xref: /freebsd/libexec/ypxfr/ypxfr.8 (revision 61e21613)
1.\" Copyright (c) 1995
2.\"	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by Bill Paul.
15.\" 4. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.Dd February 5, 1995
32.Dt YPXFR 8
33.Os
34.Sh NAME
35.Nm ypxfr
36.Nd "transfer NIS database from remote server to local host"
37.Sh SYNOPSIS
38.Nm /usr/libexec/ypxfr
39.Op Fl f
40.Op Fl c
41.Op Fl d Ar target domain
42.Op Fl h Ar source host
43.Op Fl s Ar source domain
44.Op Fl p Ar path
45.Op Fl C Ar taskid program-number ipaddr port
46.Ar mapname
47.Sh DESCRIPTION
48The
49.Nm
50utility copies an
51.Tn NIS
52database (or
53.Pa map )
54from one
55.Tn NIS
56server to another using
57.Tn NIS
58services.
59In
60.Fx ,
61.Nm
62is generally invoked by
63.Xr ypserv 8
64when it receives a map transfer request from
65.Xr yppush 8 .
66The
67.Nm
68utility is used primarily in environments where several
69.Tn NIS
70servers are in use in a single domain.
71One server, the
72.Tn NIS
73master, maintains
74the canonical copies of all
75.Tn NIS
76maps, and all the other servers,
77the
78.Tn NIS
79slaves, copy new versions of the maps from the master whenever
80any updates are made (i.e., when a user updates their password via
81.Xr yppasswd 1 ) .
82.Pp
83When run,
84.Nm
85creates a temporary database file in
86.Pa /var/yp/[domainname] ,
87and fills it with the contents of
88.Ar mapname
89as supplied by the specified
90.Ar source host .
91When the entire map has been transferred,
92.Nm
93deletes the original copy of
94.Ar mapname
95and moves the temporary copy into its place.
96When the transfer is
97complete,
98.Nm
99will attempt to send a 'clear current map' request to the local
100.Xr ypserv 8
101process to clear any possible references it may still have to the
102stale map.
103.Pp
104Note that all files created by
105.Nm
106are owner readable and writable only for security reasons.
107Since the
108.Tn NIS
109maps and the directory in which they reside are normally owned by
110root, this prevents non-privileged users from making unauthorized
111modifications.
112.Pp
113In order to maintain consistency across all
114.Tn NIS
115servers,
116.Nm
117can be run periodically in a
118.Xr cron 8
119job.
120Maps which change infrequently
121need only be updated once a day (preferably late at night when system
122usage is lowest), whereas those that are subject to frequent changes
123(such a
124.Pa passwd.byname
125and
126.Pa passwd.byuid )
127should be updated perhaps once every hour.
128Using
129.Xr cron 8
130to automatically
131update the
132.Tn NIS
133maps is not strictly mandatory since all updates should
134be propagated by
135.Xr yppush 8
136when
137.Pa /var/yp/Makefile
138is run on the
139.Tn NIS
140master server, however it is good practice
141on large networks where possible outages could cause
142.Tn NIS
143servers to fall out of sync with each other.
144.Pp
145When
146.Nm
147is invoked without a controlling terminal, e.g.\& from inside
148.Xr ypserv 8 ,
149it logs all its output using the
150.Xr syslog 3
151facility.
152.Sh NOTES
153The
154.Fx
155version of
156.Nm
157has support for a special map transfer protocol which works in
158conjunction with the
159.Fx
160.Xr rpc.ypxfrd 8
161server.
162This protocol allows it to transfer raw map database files from
163the
164.Tn NIS
165master server and can be many times faster than the standard
166transfer method, particularly for very large
167.Tn NIS
168maps.
169The
170.Nm
171utility will check to see if the
172.Xr rpc.ypxfrd 8
173server is registered on the
174.Tn NIS
175master server and attempt to use
176it if it is present.
177If it is not it will fall back to the standard
178transfer method, copying the map contents from
179.Xr ypserv 8
180and creating new maps instead.
181.Pp
182Note that while the
183.Fx
184ypxfrd protocol is conceptually similar
185to the SunOS ypxfrd protocol,
186the
187.Fx
188protocol is not compatible with
189Sun's, therefore it will not work with Sun's ypxfrd server.
190.Fx
191slave systems can still transfer maps from any
192.No non- Ns Fx
193.Tn NIS
194server,
195however they will only be able to take advantage of the faster protocol
196if the master server is also running
197.Fx .
198.Sh OPTIONS
199The following options and flags are supported by
200.Nm :
201.Bl -tag -width indent
202.It Fl f
203Force a map transfer.
204Normally,
205.Nm
206will not transfer a map if it determines that the
207.Tn NIS
208master's copy
209is not newer than the existing copy already on the local host: the
210.Fl f
211flag forces a transfer regardless of which server's version is more recent.
212.It Fl c
213Do not send a 'clear current map' request to the
214.Xr ypserv 8
215process running on the local host.
216This flag is normally used when
217invoking
218.Nm
219manually on a machine that is not yet running
220.Xr ypserv 8 .
221Without this flag, failure to contact the local
222.Tn NIS
223server will cause
224.Nm
225to abort the transfer.
226.It Fl d Ar target domain
227Specify a target domain other than the current
228.Tn NIS
229domain.
230.It Fl h Ar source host
231Specify the name of the host from which to copy the
232.Tn NIS
233maps.
234This option
235is used to ensure that
236.Nm
237only copies maps from the
238.Tn NIS
239master server.
240.It Fl s Ar source domain
241Specify the domain from which to transfer a map, in the event that
242the transfer is being done across two different
243.Tn NIS
244domains.
245.It Fl p Ar path
246Specify the top level directory containing the
247.Tn NIS
248maps.
249By
250default, this path is
251.Pa /var/yp .
252The
253.Fl p
254flag allows you to specify an alternate path should you wish to
255store your
256.Tn NIS
257maps in a different part of the file system.
258The
259.Tn NIS
260server,
261.Xr ypserv 8 ,
262passes this flag to
263.Nm
264if it too has been told to use an alternate path.
265.It Fl C Ar taskid program-number ipaddr port
266These options are used only when
267.Nm
268is invoked by
269.Xr ypserv 8
270in response to a map transfer request initiated by
271.Xr yppush 8 .
272In this instance,
273.Nm
274needs to 'callback' to the
275.Xr yppush 8
276process and interact with it, so
277.Xr yppush 8
278passes to it an IP address
279.Ar ipaddr ,
280port number
281.Ar port ,
282registered program number
283.Ar program-number
284and a transaction ID
285.Ar taskid
286that it can use to contact the waiting
287.Xr yppush 8
288process on the master server.
289.It Ar mapname
290The name of the map to transfer.
291.El
292.Sh FILES
293.Bl -tag -width Pa -compact
294.It Pa /var/yp/[domainname]/[maps]
295The
296.Tn NIS
297maps for a particular
298.Tn NIS
299domain.
300.El
301.Sh SEE ALSO
302.Xr yp 8 ,
303.Xr yppush 8 ,
304.Xr ypserv 8
305.Sh AUTHORS
306.An Bill Paul Aq Mt wpaul@ctr.columbia.edu
307