Merge Texinfo onto head.
[rsync/rsync.git] / doc / rsync.texinfo
CommitLineData
6f039cc2
MP
1\input texinfo
2@setfilename rsync.info
3@settitle rsync
4@c %** end of header
5
6@titlepage
7@sp 10
8@title rsync - fast, flexible file transfer program
9
10@c The copyright page
11@page
12@vskip 0pt plus 1filll
13Copyright @copyright{} 2002 by Martin Pool @email{mbp@@samba.org}
14
15Copyright @copyright{} 1996--2001 by Andrew Tridgell @email{tridge@@samba.org}
16@end titlepage
17
18@iftex
19@contents
20@end iftex
21
22@ifnottex
23@node Top, Overview, (dir), (dir)
24@top rsync
25
26rsync is a flexible program for efficiently copying files or directory
27trees.
28
29This manual documents rsync 2.5. It is not yet complete and should be
30consulted in conjunction with the rsync manual page.
31
32Copyright @copyright{} 2002 by Martin Pool @email{mbp@@samba.org}.
33
34Copyright @copyright{} 1996--2001 by Andrew Tridgell @email{tridge@@samba.org}.
35
36@menu
37* Overview:: Tutorial section
38* Invoking rsync::
39* Daemon mode:: rsync listens for connections on its own socket
40
41* Concept Index::
42* Option Index::
43@end menu
44
45@end ifnottex
46
47@node Overview, Invoking rsync, Top, Top
48@chapter Overview
49
50rsync is a program for efficiently copying files or directory trees.
51rsync has many options to select which files will be copied and how
52they are to be transferred. It may be used as an alternative to @sc{ftp},
53@sc{http}, @command{scp} or @command{rcp}.
54
55The rsync remote-update protocol allows rsync to transfer just the
56differences between two sets of files across the network link, using
57an efficient checksum-search algorithm described in the technical
58report that accompanies this package.
59
60rsync's command line syntax is analogous to @command{cp},
61@command{rcp} and @command{scp}:
62
63@example
64rsync [@var{options}] @var{source} @var{destination}
65@end example
66
67Filenames may be prefixed by a hostname to indicate a remote file.
68(@xref{Local and remote}.)
69
70Some of the additional features of rsync are:
71
72@itemize @bullet
73
74@item support for copying links, devices, owners, groups and permissions
75
76@item exclude and exclude-from options similar to GNU tar
77
78@item a CVS exclude mode for ignoring the same files that CVS would ignore
79
80@item can use any transparent remote shell, including rsh or ssh
81
82@item does not require root privileges
83
84@item pipelining of file transfers to minimize latency costs
85
86@item support for anonymous or authenticated rsync servers (ideal for
87mirroring)
88
89@end itemize
90
91@menu
92* Introductory example:: 60-second guide to rsync
93* Local and remote:: Local, remote, and server mode
94* Setting up rsync::
95@end menu
96
97
98
99@node Introductory example, Local and remote, Overview, Overview
100@section Introductory example
101
102Probably the most common case of rsync usage is to copy files to or
103from a remote machine using @command{ssh} as a network transport. In
104this situation rsync is a good alternative to @command{scp}.
105
106The most commonly used arguments for rsync are
107
108@table @code
109
110@item -a
111Reproduce the structure and attributes of the origin files as exactly
112as possible: this includes copying subdirectories, symlinks, special
113files, ownership and permissions. (@xref{Attributes to copy}.)
114
115@item -v
116Be verbose. Primarily, display the name of each file as it is copied.
117
118@item -z
119Compress network traffic, using a modified version of the
120@command{zlib} library.
121
122@item -P
123Display a progress indicator while files are transferred. This should
124normally be ommitted if rsync is not run on a terminal.
125
126@end table
127
128To make a backup of your home directory to the @file{/bkup/mbp/}
129remote machine @file{foo.example.org}, preserving the directory
130structure, use this command:
131
132@example
133rsync -avP ~ foo.example.org:/bkup/mbp/
134@end example
135
136
137
138@node Local and remote, Setting up rsync, Introductory example, Overview
139@comment node-name, next, previous, up
140@section Local and remote
141
142There are six different ways of using rsync. They are:
143
144@enumerate
145
146@item for copying local files. This is invoked when neither
147source nor destination path contains a @code{:} separator
148
149@item for copying from the local machine to a remote machine using
150a remote shell program as the transport (such as rsh or
151ssh). This is invoked when the destination path contains a
152single @code{:} separator.
153
154@item for copying from a remote machine to the local machine
155using a remote shell program. This is invoked when the source
156contains a @code{:} separator.
157
158@item for copying from a remote rsync server to the local
159machine. This is invoked when the source path contains a @code{::}
160separator or a @code{rsync://} URL.
161
162@item for copying from the local machine to a remote rsync
163server. This is invoked when the destination path contains a @code{::}
164separator.
165
166@item for listing files on a remote machine. This is done the
167same way as rsync transfers except that you leave off the
168local destination.
169@cindex listing files
170@end enumerate
171
172Note that in all cases (other than listing) at least one of the source
173and destination paths must be local.
174
175Any one invocation of rsync makes a copy in a single direction. rsync
176currently has no equivalent of @command{ftp}'s interactive mode.
177
178@cindex @sc{nfs}
179@cindex network filesystems
180@cindex remote filesystems
181
182rsync's network protocol is generally faster at copying files than
183network filesystems such as @sc{nfs} or @sc{cifs}. It is better to
184run rsync on the file server either as a daemon or over ssh than
185running rsync giving the network directory.
186
187
188@node Setting up rsync, , Local and remote, Overview
189@comment node-name, next, previous, up
190@section Setting up rsync
191
192@cindex installation
193See the file @sc{install} that comes with the distribution for installation
194instructions.
195
196@cindex @command{rsh}
197@cindex @command{rsh}, alternatives to
198@cindex @command{ssh}
199
200Once installed you can use rsync to any machine that you can use
201@command{rsh} to. rsync uses @command{rsh} for its communications,
202unless both the source and destination are local.
203
204You can also specify an alternative to rsh, either by using the
205@option{-e} command line option, or by setting the
206@var{@sc{rsync_rsh}} environment variable.
207
208One common substitute is to use @command{ssh}, which offers a high
209degree of security.
210
211Note that rsync must be installed on both the source and destination
212machines.
213
214
215
216@node Invoking rsync, Daemon mode, Overview, Top
217@comment node-name, next, previous, up
218@chapter Invoking rsync
219
220
221@menu
222* Controlling rsync messages::
223* Attributes to copy::
224* Exit values::
225@end menu
226
227
228
229@node Controlling rsync messages, Attributes to copy, Invoking rsync, Invoking rsync
230@comment node-name, next, previous, up
231@section Controlling rsync messages
232
233@table @option
234
235@item --version
236@vindex --version
237Print the rsync version number and compilation information and exit
238
239@item --help
240@vindex --help
241Print a short help page describing the options available and exit.
242
243@item --stats
244@vindex --stats
245Print statistics about rsync perfomance.
246
247@item -v
248@itemx --verbose
249@vindex -v
250@vindex --verbose
251This option increases the amount of information you are given during
252the transfer. By default, rsync works silently. A single -v will
253give you information about what files are being transferred and a
254brief summary at the end. Two -v flags will give you information on
255network connections, files skipped, and slightly more information at
256the end. More than two -v flags should only be used if you are
257debugging rsync.
258@end table
259
260
261@node Attributes to copy, Exit values, Controlling rsync messages, Invoking rsync
262@comment node-name, next, previous, up
263@section Attributes to copy
264
265@table @option
266
267@item -a
268@vindex -a
269@vindex --archive
270@cindex archive mode
271
272Preserve as much as possible of the structure and attributes of the
273origin directory.
274
275On many systems, only the superuser can set the ownership of files,
276and users can only put files into a group to which that user belongs.
277rsync works within the operating system security model. So on such a
278system, if you copy a file which you can read but that does not belong
279to you, the destination file will be owned by you. The only way to
280change this behaviour is to copy the file as the superuser, or to
281adjust your operating system's security model if that is possible.
282
283@quotation
284@strong{Please note:} @option{--archive} does not detect files with
285multiple names. If any exist, they will become multiple identical
286files on the destination. To make the names all refer to the same
287file, use @option{--hard-links}.
288@end quotation
289
290@end table
291
292
293
294@node Exit values, , Attributes to copy, Invoking rsync
295@comment node-name, next, previous, up
296@section Exit values
297
298@cindex exit code
299@cindex return code
300
301rsync's exit code may be examined by shell scripts to determine
302whether the transfer completed successfully or not.
303
304@table @code
305
306@item RERR_SYNTAX 1
307Syntax or usage error
308
309@item RERR_PROTOCOL 2
310Protocol incompatibility
311
312@item RERR_FILESELECT 3
313Errors selecting input/output files, dirs
314
315@item RERR_UNSUPPORTED 4
316Requested action not supported: an attempt
317was made to manipulate 64-bit files on a platform that cannot support
318them; or an option was speciifed that is supported by the client and
319not by the server.
320
321@item RERR_SOCKETIO 10
322Error in socket IO
323
324@item RERR_FILEIO 11
325Error in file IO
326
327@item RERR_STREAMIO 12
328Error in rsync protocol data stream
329
330@item RERR_MESSAGEIO 13
331Errors with program diagnostics
332
333@item RERR_IPC 14
334Error in @sc{ipc} code
335
336@item RERR_SIGNAL 20
337Received @sc{sigusr1} or @sc{sigint}
338
339@item RERR_WAITCHILD 21
340Some error returned by @code{waitpid()}
341
342@item RERR_MALLOC 22
343Error allocating core memory buffers
344
345@item RERR_TIMEOUT 30
346Timeout in data send/receive
347
348@end table
349
350
351
352@node Daemon mode, Concept Index, Invoking rsync, Top
353@chapter Daemon mode
354
355@cindex daemon mode
356@cindex demon mode
357@cindex @command{rsyncd}
358@vindex --daemon
359
360Configuring rsync as a server is entirely optional. If you just want
361to copy your own files between local directories or machines, then
362using rsync over @command{ssh} may well be sufficient. Daemon mode
363may be useful if you wish to distribute files to a number of machines
364on a network, or to the public.
365
366@vindex --port
367@cindex port 873
368@cindex @sc{tcp} port 873
369
370@sc{Tcp} port 873 is reserved for rsync by the Internet Assigned
371Numbers Authority (@sc{iana}) and has the service name @code{rsync}.
372However, rsync may be run on any other port using the @option{--port}
373option.
374
375@menu
376* Daemon mode security::
377@end menu
378
379@node Daemon mode security, , Daemon mode, Daemon mode
380@section Daemon mode security
381
382@node Concept Index, Option Index, Daemon mode, Top
383@comment node-name, next, previous, up
384@unnumbered Concept Index
385
386@printindex cp
387
388
389
390@node Option Index, , Concept Index, Top
391@comment node-name, next, previous, up
392@unnumbered Option Index
393
394@printindex vr
395
396@bye