1=encoding ISO8859-1
2
3=head1 BackupPC Introduction
4
5This documentation describes BackupPC version 3.3.2,
6released on 25 Jan 2017.
7
8=head2 Overview
9
10BackupPC is a high-performance, enterprise-grade system for backing up
11Unix, Linux, WinXX, and MacOSX PCs, desktops and laptops to a server's
12disk.  BackupPC is highly configurable and easy to install and maintain.
13
14Given the ever decreasing cost of disks and raid systems, it is now
15practical and cost effective to backup a large number of machines onto
16a server's local disk or network storage.  For some sites this might be
17the complete backup solution.  For other sites additional permanent
18archives could be created by periodically backing up the server to tape.
19
20Features include:
21
22=over 4
23
24=item *
25
26A clever pooling scheme minimizes disk storage and disk I/O.
27Identical files across multiple backups of the same or different PC
28are stored only once (using hard links), resulting in substantial
29savings in disk storage and disk writes.
30
31=item *
32
33Optional compression provides additional reductions in storage
34(around 40%).  The CPU impact of compression is low since only
35new files (those not already in the pool) need to be compressed.
36
37=item *
38
39A powerful http/cgi user interface allows administrators to view
40the current status, edit configuration, add/delete hosts, view log
41files, and allows users to initiate and cancel backups and browse
42and restore files from backups.
43
44=item *
45
46The http/cgi user interface has internationalization (i18n) support,
47currently providing English, French, German, Spanish, Italian,
48Dutch, Polish, Portuguese-Brazilian and Chinese
49
50=item *
51
52No client-side software is needed. On WinXX the standard smb
53protocol is used to extract backup data. On linux, unix or MacOSX
54clients, rsync, tar (over ssh/rsh/nfs) or ftp is used to extract
55backup data. Alternatively, rsync can also be used on WinXX (using
56cygwin), and Samba could be installed on the linux or unix client
57to provide smb shares).
58
59=item *
60
61Flexible restore options.  Single files can be downloaded from
62any backup directly from the CGI interface.  Zip or Tar archives
63for selected files or directories from any backup can also be
64downloaded from the CGI interface.  Finally, direct restore to
65the client machine (using smb or tar) for selected files or
66directories is also supported from the CGI interface.
67
68=item *
69
70BackupPC supports mobile environments where laptops are only
71intermittently connected to the network and have dynamic IP addresses
72(DHCP).  Configuration settings allow machines connected via slower WAN
73connections (eg: dial up, DSL, cable) to not be backed up, even if they
74use the same fixed or dynamic IP address as when they are connected
75directly to the LAN.
76
77=item *
78
79Flexible configuration parameters allow multiple backups to be performed
80in parallel, specification of which shares to backup, which directories
81to backup or not backup, various schedules for full and incremental
82backups, schedules for email reminders to users and so on.  Configuration
83parameters can be set system-wide or also on a per-PC basis.
84
85=item *
86
87Users are sent periodic email reminders if their PC has not
88recently been backed up.  Email content, timing and policies
89are configurable.
90
91=item *
92
93BackupPC is Open Source software hosted by SourceForge.
94
95=back
96
97=head2 Backup basics
98
99=over 4
100
101=item Full Backup
102
103A full backup is a complete backup of a share. BackupPC can be
104configured to do a full backup at a regular interval (typically
105weekly).  BackupPC can be configured to keep a certain number
106of full backups.  Exponential expiry is also supported, allowing
107full backups with various vintages to be kept (for example, a
108settable number of most recent weekly fulls, plus a settable
109number of older fulls that are 2, 4, 8, or 16 weeks apart).
110
111=item Incremental Backup
112
113An incremental backup is a backup of files that have changed
114since the last successful full or incremental backup.  Starting
115in BackupPC 3.0 multi-level incrementals are supported.
116A full backup has level 0.  A new incremental of level N will
117backup all files that have changed since the most recent backup
118of a lower level.  $Conf{IncrLevels} is used to specify the
119level of each successive incremental.  The default value is
120all level 1, which makes the behavior the same as earlier
121versions of BackupPC: each incremental will back up all the
122files that changed since the last full (level 0).
123
124For SMB and tar, BackupPC uses the modification time (mtime) to
125determine which files have changed since the last lower-level
126backup.  That means SMB and tar incrementals are not able to detect
127deleted files, renamed files or new files whose modification time
128is prior to the last lower-level backup.
129
130Rsync is more clever: any files whose attributes have changed (ie: uid,
131gid, mtime, modes, size) since the last full are backed up.  Deleted,
132new files and renamed files are detected by Rsync incrementals.
133
134BackupPC can also be configured to keep a certain number of incremental
135backups, and to keep a smaller number of very old incremental backups.
136If multi-level incrementals are specified then it is likely that
137more incrementals will need to be kept since lower-level incrementals
138(and the full backup) are needed to reconstruct a higher-level
139incremental.
140
141BackupPC "fills-in" incremental backups when browsing or restoring,
142based on the levels of each backup, giving every backup a "full"
143appearance.  This makes browsing and restoring backups much easier:
144you can restore from any one backup independent of whether it was
145an incremental or full.
146
147=item Partial Backup
148
149When a full backup fails or is canceled, and some files have already
150been backed up, BackupPC keeps a partial backup containing just the
151files that were backed up successfully.  The partial backup is removed
152when the next successful backup completes, or if another full backup
153fails resulting in a newer partial backup.  A failed full backup
154that has not backed up any files, or any failed incremental backup,
155is removed; no partial backup is saved in these cases.
156
157The partial backup may be browsed or used to restore files just like
158a successful full or incremental backup.
159
160With the rsync transfer method the partial backup is used to resume
161the next full backup, avoiding the need to retransfer the file data
162already in the partial backup.
163
164=item Identical Files
165
166BackupPC pools identical files using hardlinks.  By "identical
167files" we mean files with identical contents, not necessary the
168same permissions, ownership or modification time.  Two files might
169have different permissions, ownership, or modification time but
170will still be pooled whenever the contents are identical.  This
171is possible since BackupPC stores the file meta-data (permissions,
172ownership, and modification time) separately from the file contents.
173
174=item Backup Policy
175
176Based on your site's requirements you need to decide what your backup
177policy is.  BackupPC is not designed to provide exact re-imaging of
178failed disks.  See L<Some Limitations> for more information.
179However, the addition of tar transport for linux/unix clients, plus
180full support for special file types and unix attributes in v1.4.0
181likely means an exact image of a linux/unix file system can be made.
182
183BackupPC saves backups onto disk. Because of pooling you can relatively
184economically keep several weeks of old backups.
185
186At some sites the disk-based backup will be adequate, without a
187secondary tape backup. This system is robust to any single failure: if a
188client disk fails or loses files, the BackupPC server can be used to
189restore files. If the server disk fails, BackupPC can be restarted on a
190fresh file system, and create new backups from the clients. The chance
191of the server disk failing can be made very small by spending more money
192on increasingly better RAID systems.  However, there is still the risk
193of catastrophic events like fires or earthquakes that can destroy
194both the BackupPC server and the clients it is backing up if they
195are physically nearby.
196
197Some sites might choose to do periodic backups to tape or cd/dvd.
198This backup can be done perhaps weekly using the archive function of
199BackupPC.
200
201Other users have reported success with removable disks to rotate the
202BackupPC data drives, or using rsync to mirror the BackupPC data pool
203offsite.
204
205=back
206
207=head2 Resources
208
209=over 4
210
211=item BackupPC home page
212
213The BackupPC Open Source project is hosted on Github and SourceForge.
214The project home page can be found at:
215
216    http://backuppc.sourceforge.net
217
218This page has links to the current documentation, the Github and SourceForge
219project pages and general information.
220
221=item Github and SourceForge locations
222
223The Github project page is at:
224
225    https://github.com/backuppc/backuppc
226
227The SourceForge project page is at:
228
229    http://sourceforge.net/projects/backuppc
230
231Generally use of SourceForge has been deprecated in favor of Github.  All source
232code and development has moved to Github starting in 2016.  Releases will continue
233to be available on both Github and SourceForge.
234
235This page has links to the current releases of BackupPC.
236
237=item BackupPC Wiki
238
239BackupPC has a Wiki at L<https://github.com/backuppc/backuppc/wiki>.
240Everyone is encouraged to contribute to the Wiki.
241
242=item Mailing lists
243
244Three BackupPC mailing lists exist for announcements (backuppc-announce),
245developers (backuppc-devel), and a general user list for support, asking
246questions or any other topic relevant to BackupPC (backuppc-users).
247
248The lists are archived on SourceForge and Gmane.  The SourceForge lists
249are not always up to date and the searching is limited, so Gmane is
250a good alternative.  See:
251
252    http://news.gmane.org/index.php?prefix=gmane.comp.sysutils.backup.backuppc
253    http://sourceforge.net/mailarchive/forum.php?forum=backuppc-users
254
255You can subscribe to these lists by visiting:
256
257    http://lists.sourceforge.net/lists/listinfo/backuppc-announce
258    http://lists.sourceforge.net/lists/listinfo/backuppc-users
259    http://lists.sourceforge.net/lists/listinfo/backuppc-devel
260
261The backuppc-announce list is moderated and is used only for
262important announcements (eg: new versions).  It is low traffic.
263You only need to subscribe to one of backuppc-announce and
264backuppc-users: backuppc-users also receives any messages on
265backuppc-announce.
266
267The backuppc-devel list is only for developers who are working on BackupPC.
268Do not post questions or support requests there.  But detailed technical
269discussions should happen on this list.
270
271To post a message to the backuppc-users list, send an email to
272
273    backuppc-users@lists.sourceforge.net
274
275Do not send subscription requests to this address!
276
277=item Other Programs of Interest
278
279If you want to mirror linux or unix files or directories to a remote server
280you should use rsync, L<http://rsync.samba.org>.  BackupPC uses
281rsync as a transport mechanism; if you are already an rsync user you
282can think of BackupPC as adding efficient storage (compression and
283pooling) and a convenient user interface to rsync.
284
285Two popular open source packages that do tape backup are
286Amanda (L<http://www.amanda.org>)
287and Bacula (L<http://www.bacula.org>).
288These packages can be used as complete solutions, or also as back
289ends to BackupPC to backup the BackupPC server data to tape.
290
291Various programs and scripts use rsync to provide hardlinked backups.
292See, for example, Mike Rubel's site (L<http://www.mikerubel.org/computers/rsync_snapshots>),
293JW Schultz's dirvish (L<http://www.dirvish.org/>),
294Ben Escoto's rdiff-backup (L<http://www.nongnu.org/rdiff-backup>),
295and John Bowman's rlbackup (L<http://www.math.ualberta.ca/imaging/rlbackup>).
296
297Unison is a utility that can do two-way, interactive, synchronization.
298See L<http://freshmeat.net/projects/unison>.  An external wrapper around
299rsync that maintains transfer data to enable two-way synchronization is
300drsync; see L<http://freshmeat.net/projects/drsync>.
301
302BackupPC provides many additional features, such as compressed storage,
303hardlinking any matching files (rather than just files with the same name),
304and storing special files without root privileges.  But these other programs
305provide simple, effective and fast solutions and are definitely worthy of
306consideration.
307
308=back
309
310=head2 Road map
311
312The new features planned for future releases of BackupPC
313are on the Wiki at L<http://backuppc.wiki.sourceforge.net>.
314
315Comments and suggestions are welcome.
316
317=head2 You can help
318
319BackupPC is free. I work on BackupPC because I enjoy doing it and I like
320to contribute to the open source community.
321
322BackupPC already has more than enough features for my own needs.  The
323main compensation for continuing to work on BackupPC is knowing that
324more and more people find it useful.  So feedback is certainly
325appreciated, both positive and negative.
326
327Beyond being a satisfied user and telling other people about it, everyone
328is encouraged to add links to L<http://backuppc.sourceforge.net>
329(I'll see them via Google) or otherwise publicize BackupPC.  Unlike
330the commercial products in this space, I have a zero budget (in both
331time and money) for marketing, PR and advertising, so it's up to
332all of you!  Feel free to vote for BackupPC at
333L<http://freshmeat.net/projects/backuppc>.
334
335Also, everyone is encouraged to contribute patches, bug reports,
336feature and design suggestions, new code, Wiki additions (you can
337do those directly) and documentation corrections or improvements.
338Answering questions on the mailing list is a big help too.
339
340=head1 Installing BackupPC
341
342=head2 Requirements
343
344BackupPC requires:
345
346=over 4
347
348=item *
349
350A linux, solaris, or unix based server with a substantial amount of free
351disk space (see the next section for what that means). The CPU and disk
352performance on this server will determine how many simultaneous backups
353you can run. You should be able to run 4-8 simultaneous backups on a
354moderately configured server.
355
356Several users have reported significantly better performance using
357reiserfs compared to ext3 for the BackupPC data file system.  It is
358also recommended you consider either an LVM or RAID setup (either
359in HW or SW; eg: 3Ware RAID10 or RAID5) so that you can expand the
360file system as necessary.
361
362When BackupPC starts with an empty pool, all the backup data will be
363written to the pool on disk. After more backups are done, a higher
364percentage of incoming files will already be in the pool. BackupPC is
365able to avoid writing to disk new files that are already in the pool.
366So over time disk writes will reduce significantly (by perhaps a factor
367of 20 or more), since eventually 95% or more of incoming backup files
368are typically in the pool. Disk reads from the pool are still needed to
369do file compares to verify files are an exact match. So, with a mature
370pool, if a relatively fast client generates data at say 1MB/sec, and you
371run 4 simultaneous backups, there will be an average server disk load of
372about 4MB/sec reads and 0.2MB/sec writes (assuming 95% of the incoming
373files are in the pool). These rates will be perhaps 40% lower if
374compression is on.
375
376=item *
377
378Perl version 5.8.0 or later.  If you don't have perl, please
379see L<http://www.cpan.org>.
380
381=item *
382
383Perl modules Compress::Zlib, Archive::Zip and File::RsyncP.  Try "perldoc
384Compress::Zlib" and "perldoc Archive::Zip" to see if you have these
385modules.  If not, fetch them from L<http://www.cpan.org> and see the
386instructions below for how to build and install them.
387
388The CGI Perl module is required for the http/cgi user interface. CGI was a core
389module, but from version 5.22 Perl no longer ships with it.
390
391The File::RsyncP module is available from L<http://perlrsync.sourceforge.net>
392or CPAN.  You'll need to install the File::RsyncP module if you want to use
393Rsync as a transport method.
394
395=item *
396
397If you are using smb to backup WinXX machines you need smbclient and
398nmblookup from the samba package.  You will also need nmblookup if
399you are backing up linux/unix DHCP machines.  See L<http://www.samba.org>.
400Samba versions 3.x are stable and now recommended instead of 2.x.
401
402See L<http://www.samba.org> for source and binaries.  It's pretty easy to
403fetch and compile samba, and just grab smbclient and nmblookup, without
404doing the installation. Alternatively, L<http://www.samba.org> has binary
405distributions for most platforms.
406
407=item *
408
409If you are using tar to backup linux/unix machines, those machines should have
410version 1.13.7 at a minimum, with version 1.13.20 or higher recommended.  Use
411"tar --version" to check your version.  Various GNU mirrors have the newest
412versions of tar; see L<http://www.gnu.org/software/tar/>.
413
414=item *
415
416If you are using rsync to backup linux/unix machines you should have
417version 2.6.3 or higher on each client machine.  See
418L<http://rsync.samba.org>. Use "rsync --version" to check your version.
419
420For BackupPC to use Rsync you will also need to install the perl
421File::RsyncP module, which is available from
422L<http://perlrsync.sourceforge.net>.
423Version 0.68 or later is required.
424
425=item *
426
427The Apache web server, see L<http://www.apache.org>, preferably built
428with mod_perl support.
429
430=back
431
432=head2 What type of storage space do I need?
433
434BackupPC uses hardlinks to pool files common to different backups.
435Therefore BackupPC's data store (__TOPDIR__) must point to a single
436file system that supports hardlinks.  You cannot split this file
437system with multiple mount points or using symbolic links to point a
438sub-directory to a different file system (it is ok to use a single
439symbolic link at the top-level directory (__TOPDIR__) to point the
440entire data store somewhere else).  You can of course use any kind of
441RAID system or logical volume manager that combines the capacity of
442multiple disks into a single, larger, file system. Such approaches
443have the advantage that the file system can be expanded without having
444to copy it.
445
446Any standard linux or unix file system supports hardlinks.  NFS mounted
447file systems work too (provided the underlying file system supports
448hardlinks).  But windows based FAT and NTFS file systems will not work.
449
450Starting with BackupPC 3.1.0, run-time checks are done at startup and
451at the start of each backup to ensure that the file system can support
452hardlinks, since this is a common area of configuration problems.
453
454=head2 How much disk space do I need?
455
456Here's one real example for an environment that is backing up 65 laptops
457with compression off. Each full backup averages 3.2GB. Each incremental
458backup averages about 0.2GB. Storing one full backup and two incremental
459backups per laptop is around 240GB of raw data. But because of the
460pooling of identical files, only 87GB is used.  This is without
461compression.
462
463Another example, with compression on: backing up 95 laptops, where
464each backup averages 3.6GB and each incremental averages about 0.3GB.
465Keeping three weekly full backups, and six incrementals is around
4661200GB of raw data.  Because of pooling and compression, only 150GB
467is needed.
468
469Here's a rule of thumb. Add up the disk usage of all the machines you
470want to backup (210GB in the first example above). This is a rough
471minimum space estimate that should allow a couple of full backups and at
472least half a dozen incremental backups per machine. If compression is on
473you can reduce the storage requirements by maybe 30-40%.  Add some margin
474in case you add more machines or decide to keep more old backups.
475
476Your actual mileage will depend upon the types of clients, operating
477systems and applications you have. The more uniform the clients and
478applications the bigger the benefit from pooling common files.
479
480For example, the Eudora email tool stores each mail folder in a separate
481file, and attachments are extracted as separate files. So in the sadly
482common case of a large attachment emailed to many recipients, Eudora
483will extract the attachment into a new file. When these machines are
484backed up, only one copy of the file will be stored on the server, even
485though the file appears in many different full or incremental backups. In
486this sense Eudora is a "friendly" application from the point of view of
487backup storage requirements.
488
489An example at the other end of the spectrum is Outlook. Everything
490(email bodies, attachments, calendar, contact lists) is stored in a
491single file, which often becomes huge. Any change to this file requires
492a separate copy of the file to be saved during backup. Outlook is even
493more troublesome, since it keeps this file locked all the time, so it
494cannot be read by smbclient whenever Outlook is running.  See the
495L<Some Limitations> section for more discussion of this problem.
496
497In addition to total disk space, you should make sure you have
498plenty of inodes on your BackupPC data partition. Some users have
499reported running out of inodes on their BackupPC data partition.
500So even if you have plenty of disk space, BackupPC will report
501failures when the inodes are exhausted.  This is a particular
502problem with ext2/ext3 file systems that have a fixed number of
503inodes when the file system is built.  Use "df -i" to see your
504inode usage.
505
506=head2 Step 1: Getting BackupPC
507
508Some linux distributions now include BackupPC.  The Debian
509distribution, supported by Ludovic Drolez, can be found at
510L<http://packages.debian.org/backuppc> and is included
511in the current stable Debian release.  On Debian, BackupPC can
512be installed with the command:
513
514    apt-get install backuppc
515
516In the future there might be packages for Gentoo and other
517linux flavors.  If the packaged version is older than the
518released version then you may want to install the
519latest version as described below.
520
521Otherwise, manually fetching and installing BackupPC is easy.
522Start by downloading the latest version from
523L<http://backuppc.sourceforge.net>.  Hit the "Code" button,
524then select the "backuppc" or "backuppc-beta" package and
525download the latest version.
526
527=head2 Step 2: Installing the distribution
528
529Note: most information in this step is only relevant if you build
530and install BackupPC yourself.  If you use a package provided by a
531distribution, the package management system should take of installing
532any needed dependencies.
533
534First off, there are five perl modules you should install.
535These are all optional, but highly recommended:
536
537=over 4
538
539=item Compress::Zlib
540
541To enable compression, you will need to install Compress::Zlib
542from L<http://www.cpan.org>.
543You can run "perldoc Compress::Zlib" to see if this module is installed.
544
545=item Archive::Zip
546
547To support restore via Zip archives you will need to install
548Archive::Zip, also from L<http://www.cpan.org>.
549You can run "perldoc Archive::Zip" to see if this module is installed.
550
551=item XML::RSS
552
553To support the RSS feature you will need to install XML::RSS, also from
554L<http://www.cpan.org>.  There is not need to install this module if you
555don't plan on using RSS. You can run "perldoc XML::RSS" to see if this
556module is installed.
557
558=item File::RsyncP
559
560To use rsync and rsyncd with BackupPC you will need to install File::RsyncP.
561You can run "perldoc File::RsyncP" to see if this module is installed.
562File::RsyncP is available from L<http://perlrsync.sourceforge.net>.
563Version 0.68 or later is required.
564
565=item File::Listing, Net::FTP, Net::FTP::RetrHandle, Net::FTP::AutoReconnect
566
567To use ftp with BackupPC you will need four libraries, but actually
568need to install only File::Listing from L<http://www.cpan.org>.
569You can run "perldoc File::Listing" to see if this module is installed.
570Net::FTP is a standard module. Net::FTP::RetrHandle and
571Net::FTP::AutoReconnect included in BackupPC distribution.
572
573=back
574
575To build and install these packages you should use the cpan program.
576Alternatively, you can fetch the tar.gz file from L<http://www.cpan.org>
577and then run these commands:
578
579    tar zxvf Archive-Zip-1.26.tar.gz
580    cd Archive-Zip-1.26
581    perl Makefile.PL
582    make
583    make test
584    make install
585
586The same sequence of commands can be used for each module.
587
588Now let's move onto BackupPC itself.  After fetching
589BackupPC-3.3.2.tar.gz, run these commands as root:
590
591    tar zxf BackupPC-3.3.2.tar.gz
592    cd BackupPC-3.3.2
593    perl configure.pl
594
595In the future this release might also have patches available on the
596SourceForge site.  These patch files are text files, with a name of
597the form
598
599    BackupPC-3.3.2plN.diff
600
601where N is the patch level, eg: pl2 is patch-level 2.  These
602patch files are cumulative: you only need apply the last patch
603file, not all the earlier patch files.  If a patch file is
604available, eg: BackupPC-3.3.2pl2.diff, you should apply
605the patch after extracting the tar file:
606
607     # fetch BackupPC-3.3.2.tar.gz
608     # fetch BackupPC-3.3.2pl2.diff
609     tar zxf BackupPC-3.3.2.tar.gz
610     cd BackupPC-3.3.2
611     patch -p0 < ../BackupPC-3.3.2pl2.diff
612     perl configure.pl
613
614A patch file includes comments that describe that bug fixes
615and changes.  Feel free to review it before you apply the patch.
616
617The configure.pl script also accepts command-line options if you
618wish to run it in a non-interactive manner.  It has self-contained
619documentation for all the command-line options, which you can
620read with perldoc:
621
622    perldoc configure.pl
623
624Starting with BackupPC 3.0.0, the configure.pl script by default
625complies with the file system hierarchy (FHS) conventions.  The
626major difference compared to earlier versions is that by default
627configuration files will be stored in /etc/BackupPC
628rather than below the data directory, __TOPDIR__/conf,
629and the log files will be stored in /var/log/BackupPC
630rather than below the data directory, __TOPDIR__/log.
631
632Note that distributions may choose to use different locations for
633BackupPC files than these defaults.
634
635If you are upgrading from an earlier version the configure.pl script
636will keep the configuration files and log files in their original
637location.
638
639When you run configure.pl you will be prompted for the full paths
640of various executables, and you will be prompted for the following
641information.
642
643=over 4
644
645=item BackupPC User
646
647It is best if BackupPC runs as a special user, eg backuppc, that has
648limited privileges. It is preferred that backuppc belongs to a system
649administrator group so that sys admin members can browse BackupPC files,
650edit the configuration files and so on. Although configurable, the
651default settings leave group read permission on pool files, so make
652sure the BackupPC user's group is chosen restrictively.
653
654On this installation, this is __BACKUPPCUSER__.
655
656For security purposes you might choose to configure the BackupPC
657user with the shell set to /bin/false.  Since you might need to
658run some BackupPC programs as the BackupPC user for testing
659purposes, you can use the -m option to su to run
660a shell, eg:
661
662    su -m __BACKUPPCUSER__
663
664Depending upon your configuration you might also need the -l option.
665
666=item Data Directory
667
668You need to decide where to put the data directory, below which
669all the BackupPC data is stored.  This needs to be a big file system.
670
671On this installation, this is __TOPDIR__.
672
673=item Install Directory
674
675You should decide where the BackupPC scripts, libraries and documentation
676should be installed, eg: /usr/local/BackupPC.
677
678On this installation, this is __INSTALLDIR__.
679
680=item CGI bin Directory
681
682You should decide where the BackupPC CGI script resides.  This will
683usually be below Apache's cgi-bin directory.
684
685It is also possible to use a different directory and use Apache's
686``<Directory>'' directive to specifiy that location.  See the Apache
687HTTP Server documentation for additional information.
688
689On this installation, this is __CGIDIR__.
690
691=item Apache image Directory
692
693A directory where BackupPC's images are stored so that Apache can
694serve them.  You should ensure this directory is readable by Apache and
695create a symlink to this directory from the BackupPC CGI bin Directory.
696
697=item Config and Log Directories
698
699In this installation the configuration and log directories are
700located in the following locations:
701
702    __CONFDIR__/config.pl    main config file
703    __CONFDIR__/hosts        hosts file
704    __CONFDIR__/pc/HOST.pl   per-pc config file
705    __LOGDIR__/BackupPC      log files, pid, status
706
707The configure.pl script doesn't prompt for these locations but
708they can be set for new installations using command-line options.
709
710=back
711
712=head2 Step 3: Setting up config.pl
713
714After running configure.pl, browse through the config file,
715__CONFDIR__/config.pl, and make sure all the default settings are
716correct. In particular, you will need to decide whether to use
717smb, tar,or rsync or ftp transport (or whether to set it on a
718per-PC basis) and set the relevant parameters for that transport
719method. See the section L<Step 5: Client Setup> for
720more details.
721
722=head2 Step 4: Setting up the hosts file
723
724The file __CONFDIR__/hosts contains the list of clients to backup.
725BackupPC reads this file in three cases:
726
727=over 4
728
729=item *
730
731Upon startup.
732
733=item *
734
735When BackupPC is sent a HUP (-1) signal.  Assuming you installed the
736init.d script, you can also do this with "/etc/init.d/backuppc reload".
737
738=item *
739
740When the modification time of the hosts file changes.  BackupPC
741checks the modification time once during each regular wakeup.
742
743=back
744
745Whenever you change the hosts file (to add or remove a host) you can
746either do a kill -HUP BackupPC_pid or simply wait until the next regular
747wakeup period.
748
749Each line in the hosts file contains three fields, separated
750by white space:
751
752=over 4
753
754=item Host name
755
756This is typically the host name or NetBios name of the client machine
757and should be in lower case.  The host name can contain spaces (escape
758with a backslash), but it is not recommended.
759
760Please read the section L<How BackupPC Finds Hosts>.
761
762In certain cases you might want several distinct clients to refer
763to the same physical machine.  For example, you might have a database
764you want to backup, and you want to bracket the backup of the database
765with shutdown/restart using $Conf{DumpPreUserCmd} and $Conf{DumpPostUserCmd}.
766But you also want to backup the rest of the machine while the database
767is still running.  In the case you can specify two different clients in
768the host file, using any mnemonic name (eg: myhost_mysql and myhost), and
769use $Conf{ClientNameAlias} in myhost_mysql's config.pl to specify the
770real host name of the machine.
771
772=item DHCP flag
773
774Starting with v2.0.0 the way hosts are discovered has changed and now
775in most cases you should specify 0 for the DHCP flag, even if the host
776has a dynamically assigned IP address.
777Please read the section L<How BackupPC Finds Hosts>
778to understand whether you need to set the DHCP flag.
779
780You only need to set DHCP to 1 if your client machine doesn't
781respond to the NetBios multicast request:
782
783    nmblookup myHost
784
785but does respond to a request directed to its IP address:
786
787    nmblookup -A W.X.Y.Z
788
789If you do set DHCP to 1 on any client you will need to specify the range of
790DHCP addresses to search is specified in $Conf{DHCPAddressRanges}.
791
792Note also that the $Conf{ClientNameAlias} feature does not work for
793clients with DHCP set to 1.
794
795=item User name
796
797This should be the unix login/email name of the user who "owns" or uses
798this machine. This is the user who will be sent email about this
799machine, and this user will have permission to stop/start/browse/restore
800backups for this host.  Leave this blank if no specific person should
801receive email or be allowed to stop/start/browse/restore backups
802for this host.  Administrators will still have full permissions.
803
804=item More users
805
806Additional user names, separate by commas and with no white space,
807can be specified.  These users will also have full permission in
808the CGI interface to stop/start/browse/restore backups for this host.
809These users will not be sent email about this host.
810
811=back
812
813The first non-comment line of the hosts file is special: it contains
814the names of the columns and should not be edited.
815
816Here's a simple example of a hosts file:
817
818    host        dhcp    user      moreUsers
819    farside     0       craig     jim,dave
820    larson      1       gary      andy
821
822=head2 Step 5: Client Setup
823
824Four methods for getting backup data from a client are supported:
825smb, tar, rsync and ftp.  Smb or rsync are the preferred methods
826for WinXX clients and rsync or tar are the preferred methods for
827linux/unix/MacOSX clients.
828
829The transfer method is set using the $Conf{XferMethod} configuration
830setting. If you have a mixed environment (ie: you will use smb for some
831clients and tar for others), you will need to pick the most common
832choice for $Conf{XferMethod} for the main config.pl file, and then
833override it in the per-PC config file for those hosts that will use
834the other method.  (Or you could run two completely separate instances
835of BackupPC, with different data directories, one for WinXX and the
836other for linux/unix, but then common files between the different
837machine types will duplicated.)
838
839Here are some brief client setup notes:
840
841=over 4
842
843=item WinXX
844
845One setup for WinXX clients is to set $Conf{XferMethod} to "smb".
846Actually, rsyncd is the better method for WinXX if you are prepared to
847run rsync/cygwin on your WinXX client.
848
849If you want to use rsyncd for WinXX clients you can find a pre-packaged
850zip file on L<http://backuppc.sourceforge.net>. The package is called
851cygwin-rsync. It contains rsync.exe, template setup files and the
852minimal set of cygwin libraries for everything to run.  The README file
853contains instructions for running rsync as a service, so it starts
854automatically everytime you boot your machine.  If you use rsync
855to backup WinXX machines, be sure to set $Conf{ClientCharset}
856correctly (eg: 'cp1252') so that the WinXX file name encoding is
857correctly converted to utf8.
858
859Otherwise, to use SMB, you can either create shares for the data you want
860to backup or your can use the existing C$ share.  To create a new
861share, open "My Computer", right click on the drive (eg: C), and
862select "Sharing..." (or select "Properties" and select the "Sharing"
863tab). In this dialog box you can enable sharing, select the share name
864and permissions.
865
866All Windows NT based OS (NT, 2000, XP Pro), are configured by default
867to share the entire C drive as C$.  This is a special share used for
868various administration functions, one of which is to grant access to backup
869operators. All you need to do is create a new domain user, specifically
870for backup. Then add the new backup user to the built in "Backup
871Operators" group. You now have backup capability for any directory on
872any computer in the domain in one easy step. This avoids using
873administrator accounts and only grants permission to do exactly what you
874want for the given user, i.e.: backup.
875Also, for additional security, you may wish to deny the ability for this
876user to logon to computers in the default domain policy.
877
878If this machine uses DHCP you will also need to make sure the
879NetBios name is set.  Go to Control Panel|System|Network Identification
880(on Win2K) or Control Panel|System|Computer Name (on WinXP).
881Also, you should go to Control Panel|Network Connections|Local Area
882Connection|Properties|Internet Protocol (TCP/IP)|Properties|Advanced|WINS
883and verify that NetBios is not disabled.
884
885The relevant configuration settings are $Conf{SmbShareName},
886$Conf{SmbShareUserName}, $Conf{SmbSharePasswd}, $Conf{SmbClientPath},
887$Conf{SmbClientFullCmd}, $Conf{SmbClientIncrCmd} and
888$Conf{SmbClientRestoreCmd}.
889
890BackupPC needs to know the smb share user name and password for a
891client machine that uses smb.  The user name is specified in
892$Conf{SmbShareUserName}. There are four ways to tell BackupPC the
893smb share password:
894
895=over 4
896
897=item *
898
899As an environment variable BPC_SMB_PASSWD set before BackupPC starts.
900If you start BackupPC manually the BPC_SMB_PASSWD variable must be set
901manually first.  For backward compatibility for v1.5.0 and prior, the
902environment variable PASSWD can be used if BPC_SMB_PASSWD is not set.
903Warning: on some systems it is possible to see environment variables of
904running processes.
905
906=item *
907
908Alternatively the BPC_SMB_PASSWD setting can be included in
909/etc/init.d/backuppc, in which case you must make sure this file
910is not world (other) readable.
911
912=item *
913
914As a configuration variable $Conf{SmbSharePasswd} in
915__CONFDIR__/config.pl.  If you put the password
916here you must make sure this file is not world (other) readable.
917
918=item *
919
920As a configuration variable $Conf{SmbSharePasswd} in the per-PC
921configuration file (__CONFDIR__/pc/$host.pl or
922__TOPDIR__/pc/$host/config.pl in non-FHS versions of BackupPC).
923You will have to use this option if the smb share password is different
924for each host. If you put the password here you must make sure this file
925is not world (other) readable.
926
927=back
928
929Placement and protection of the smb share password is a possible
930security risk, so please double-check the file and directory
931permissions.  In a future version there might be support for
932encryption of this password, but a private key will still have to
933be stored in a protected place.  Suggestions are welcome.
934
935As an alternative to setting $Conf{XferMethod} to "smb" (using
936smbclient) for WinXX clients, you can use an smb network filesystem (eg:
937ksmbfs or similar) on your linux/unix server to mount the share,
938and then set $Conf{XferMethod} to "tar" (use tar on the network
939mounted file system).
940
941Also, to make sure that file names with special characters are correctly
942transferred by smbclient you should make sure that the smb.conf file
943has (for samba 3.x):
944
945    [global]
946	unix charset = UTF8
947
948UTF8 is the default setting, so if the parameter is missing then it
949is ok.  With this setting $Conf{ClientCharset} should be emtpy,
950since smbclient has already converted the file names to utf8.
951
952=item Linux/Unix
953
954The preferred setup for linux/unix clients is to set $Conf{XferMethod}
955to "rsync", "rsyncd" or "tar".
956
957You can use either rsync, smb, or tar for linux/unix machines. Smb requires
958that the Samba server (smbd) be run to provide the shares. Since the smb
959protocol can't represent special files like symbolic links and fifos,
960tar and rsync are the better transport methods for linux/unix machines.
961(In fact, by default samba makes symbolic links look like the file or
962directory that they point to, so you could get an infinite loop if a
963symbolic link points to the current or parent directory. If you really
964need to use Samba shares for linux/unix backups you should turn off the
965"follow symlinks" samba config setting. See the smb.conf manual page.)
966
967The requirements for each Xfer Method are:
968
969=over 4
970
971=item tar
972
973You must have GNU tar on the client machine.  Use "tar --version"
974or "gtar --version" to verify.  The version should be at least
9751.13.7, and 1.13.20 or greater is recommended.  Tar is run on
976the client machine via rsh or ssh.
977
978The relevant configuration settings are $Conf{TarClientPath},
979$Conf{TarShareName}, $Conf{TarClientCmd}, $Conf{TarFullArgs},
980$Conf{TarIncrArgs}, and $Conf{TarClientRestoreCmd}.
981
982=item rsync
983
984You should have at least rsync 2.6.3, and the latest version is
985recommended.  Rsync is run on the remote client via rsh or ssh.
986
987The relevant configuration settings are $Conf{RsyncClientPath},
988$Conf{RsyncClientCmd}, $Conf{RsyncClientRestoreCmd}, $Conf{RsyncShareName},
989$Conf{RsyncArgs}, and $Conf{RsyncRestoreArgs}.
990
991=item rsyncd
992
993You should have at least rsync 2.6.3, and the latest version is
994recommended.  In this case the rsync daemon should be running on
995the client machine and BackupPC connects directly to it.
996
997The relevant configuration settings are $Conf{RsyncdClientPort},
998$Conf{RsyncdUserName}, $Conf{RsyncdPasswd}, $Conf{RsyncdAuthRequired},
999$Conf{RsyncShareName}, $Conf{RsyncArgs}, $Conf{RsyncArgsExtra}, and
1000$Conf{RsyncRestoreArgs}. $Conf{RsyncShareName} is the name of an rsync
1001module (ie: the thing in square brackets in rsyncd's conf file -- see
1002rsyncd.conf), not a file system path.
1003
1004Be aware that rsyncd will remove the leading '/' from path names in
1005symbolic links if you specify "use chroot = no" in the rsynd.conf file.
1006See the rsyncd.conf manual page for more information.
1007
1008=item ftp
1009
1010You need to be running an ftp server on the client machine.
1011The relevant configuration settings are $Conf{FtpShareName},
1012$Conf{FtpUserName}, $Conf{FtpPasswd}, $Conf{FtpBlockSize},
1013$Conf{FtpPort}, $Conf{FtpTimeout}, and $Conf{FtpFollowSymlinks}.
1014
1015=back
1016
1017You need to set $Conf{ClientCharset} to the client's charset so that
1018file names are correctly converted to utf8.  Use "locale charmap"
1019on the client to see its charset.
1020
1021For linux/unix machines you should not backup "/proc".  This directory
1022contains a variety of files that look like regular files but they are
1023special files that don't need to be backed up (eg: /proc/kcore is a
1024regular file that contains physical memory).  See $Conf{BackupFilesExclude}.
1025It is safe to back up /dev since it contains mostly character-special
1026and block-special files, which are correctly handed by BackupPC
1027(eg: backing up /dev/hda5 just saves the block-special file information,
1028not the contents of the disk).
1029
1030Alternatively, rather than backup all the file systems as a single
1031share ("/"), it is easier to restore a single file system if you backup
1032each file system separately.  To do this you should list each file system
1033mount point in $Conf{TarShareName} or $Conf{RsyncShareName}, and add the
1034--one-file-system option to $Conf{TarClientCmd} or $Conf{RsyncArgs}.
1035In this case there is no need to exclude /proc explicitly since it looks
1036like a different file system.
1037
1038Next you should decide whether to run tar over ssh, rsh or nfs. Ssh is
1039the preferred method. Rsh is not secure and therefore not recommended.
1040Nfs will work, but you need to make sure that the BackupPC user (running
1041on the server) has sufficient permissions to read all the files below
1042the nfs mount.
1043
1044Ssh allows BackupPC to run as a privileged user on the client (eg:
1045root), since it needs sufficient permissions to read all the backup
1046files. Ssh is setup so that BackupPC on the server (an otherwise low
1047privileged user) can ssh as root on the client, without being prompted
1048for a password. There are two common versions of ssh: v1 and v2. Here
1049are some instructions for one way to setup ssh.  (Check which version
1050of SSH you have by typing "ssh" or "man ssh".)
1051
1052=item MacOSX
1053
1054In general this should be similar to Linux/Unix machines.
1055In versions 10.4 and later, the native MacOSX tar works,
1056and also supports resource forks.  xtar is another option,
1057and rsync works too (although the MacOSX-supplied rsync
1058has an extension for extended attributes that is not
1059compatible with standard rsync).
1060
1061=item SSH Setup
1062
1063SSH is a secure way to run tar or rsync on a backup client to extract
1064the data.  SSH provides strong authentication and encryption of
1065the network data.
1066
1067Note that if you run rsyncd (rsync daemon), ssh is not used.
1068In this case, rsyncd provides its own authentication, but there
1069is no encryption of network data.  If you want encryption of
1070network data you can use ssh to create a tunnel, or use a
1071program like stunnel.
1072
1073Setup instructions for ssh can be found at
1074L<http://backuppc.sourceforge.net/faq/ssh.html> or on the Wiki.
1075
1076=item Clients that use DHCP
1077
1078If a client machine uses DHCP BackupPC needs some way to find the
1079IP address given the host name.  One alternative is to set dhcp
1080to 1 in the hosts file, and BackupPC will search a pool of IP
1081addresses looking for hosts.  More efficiently, it is better to
1082set dhcp = 0 and provide a mechanism for BackupPC to find the
1083IP address given the host name.
1084
1085For WinXX machines BackupPC uses the NetBios name server to determine
1086the IP address given the host name.
1087For unix machines you can run nmbd (the NetBios name server) from
1088the Samba distribution so that the machine responds to a NetBios
1089name request. See the manual page and Samba documentation for more
1090information.
1091
1092Alternatively, you can set $Conf{NmbLookupFindHostCmd} to any command
1093that returns the IP address given the host name.
1094
1095Please read the section L<How BackupPC Finds Hosts>
1096for more details.
1097
1098=back
1099
1100=head2 Step 6: Running BackupPC
1101
1102The installation contains an init.d backuppc script that can be copied
1103to /etc/init.d so that BackupPC can auto-start on boot.
1104See init.d/README for further instructions.
1105
1106BackupPC should be ready to start.  If you installed the init.d script,
1107then you should be able to run BackupPC with:
1108
1109    /etc/init.d/backuppc start
1110
1111(This script can also be invoked with "stop" to stop BackupPC and "reload"
1112to tell BackupPC to reload config.pl and the hosts file.)
1113
1114Otherwise, just run
1115
1116     __INSTALLDIR__/bin/BackupPC -d
1117
1118as user __BACKUPPCUSER__.  The -d option tells BackupPC to run as a daemon
1119(ie: it does an additional fork).
1120
1121Any immediate errors will be printed to stderr and BackupPC will quit.
1122Otherwise, look in __LOGDIR__/LOG and verify that BackupPC reports
1123it has started and all is ok.
1124
1125=head2 Step 7: Talking to BackupPC
1126
1127You should verify that BackupPC is running by using BackupPC_serverMesg.
1128This sends a message to BackupPC via the unix (or TCP) socket and prints
1129the response.  Like all BackupPC programs, BackupPC_serverMesg
1130should be run as the BackupPC user (__BACKUPPCUSER__), so you
1131should
1132
1133    su __BACKUPPCUSER__
1134
1135before running BackupPC_serverMesg.  If the BackupPC user is
1136configured with /bin/false as the shell, you can use the -m
1137option to su to run a shell, eg:
1138
1139    su -m __BACKUPPCUSER__
1140
1141Depending upon your configuration you might also need
1142the -l option.
1143
1144You can request status information and start and stop backups using this
1145interface. This socket interface is mainly provided for the CGI interface
1146(and some of the BackupPC sub-programs use it too).  But right now we just
1147want to make sure BackupPC is happy.  Each of these commands should
1148produce some status output:
1149
1150    __INSTALLDIR__/bin/BackupPC_serverMesg status info
1151    __INSTALLDIR__/bin/BackupPC_serverMesg status jobs
1152    __INSTALLDIR__/bin/BackupPC_serverMesg status hosts
1153
1154The output should be some hashes printed with Data::Dumper.  If it
1155looks cryptic and confusing, and doesn't look like an error message,
1156then all is ok.
1157
1158The jobs status should initially show just BackupPC_trashClean.
1159The hosts status should produce a list of every host you have listed
1160in __CONFDIR__/hosts as part of a big cryptic output line.
1161
1162You can also request that all hosts be queued:
1163
1164    __INSTALLDIR__/bin/BackupPC_serverMesg backup all
1165
1166At this point you should make sure the CGI interface works since
1167it will be much easier to see what is going on.  That's our
1168next subject.
1169
1170=head2 Step 8: Checking email delivery
1171
1172The script BackupPC_sendEmail sends status and error emails to
1173the administrator and users.  It is usually run each night
1174by BackupPC_nightly.
1175
1176To verify that it can run sendmail and deliver email correctly
1177you should ask it to send a test email to you:
1178
1179    su __BACKUPPCUSER__
1180    __INSTALLDIR__/bin/BackupPC_sendEmail -u MYNAME@MYDOMAIN.COM
1181
1182BackupPC_sendEmail also takes a -c option that checks if BackupPC
1183is running, and it sends an email to $Conf{EMailAdminUserName}
1184if it is not.  That can be used as a keep-alive check by adding
1185
1186    __INSTALLDIR__/bin/BackupPC_sendEmail -c
1187
1188to __BACKUPPCUSER__'s cron.
1189
1190The -t option to BackupPC_sendEmail causes it to print the email
1191message instead of invoking sendmail to deliver the message.
1192
1193=head2 Step 9: CGI interface
1194
1195The CGI interface script, BackupPC_Admin, is a powerful and flexible
1196way to see and control what BackupPC is doing.  It is written for an
1197Apache server.  If you don't have Apache, see L<http://www.apache.org>.
1198
1199There are two options for setting up the CGI interface: standard
1200mode and using mod_perl.  Mod_perl provides much higher performance
1201(around 15x) and is the best choice if your Apache was built with
1202mod_perl support.  To see if your apache was built with mod_perl
1203run this command:
1204
1205    httpd -l | egrep mod_perl
1206
1207If this prints mod_perl.c then your Apache supports mod_perl.
1208
1209Note: on some distributions (like Debian) the command is not ``httpd'',
1210but ``apache'' or ``apache2''. Those distributions will generally also
1211use ``apache'' for the Apache user account and configuration files.
1212
1213Using mod_perl with BackupPC_Admin requires a dedicated Apache
1214to be run as the BackupPC user (__BACKUPPCUSER__).  This is
1215because BackupPC_Admin needs permission to access various files
1216in BackupPC's data directories.  In contrast, the standard
1217installation (without mod_perl) solves this problem by having
1218BackupPC_Admin installed as setuid to the BackupPC user, so that
1219BackupPC_Admin runs as the BackupPC user.
1220
1221Here are some specifics for each setup:
1222
1223=over 4
1224
1225=item Standard Setup
1226
1227The CGI interface should have been installed by the configure.pl script
1228in __CGIDIR__/BackupPC_Admin.  BackupPC_Admin should have been installed
1229as setuid to the BackupPC user (__BACKUPPCUSER__), in addition to user
1230and group execute permission.
1231
1232You should be very careful about permissions on BackupPC_Admin and
1233the directory __CGIDIR__: it is important that normal users cannot
1234directly execute or change BackupPC_Admin, otherwise they can access
1235backup files for any PC. You might need to change the group ownership
1236of BackupPC_Admin to a group that Apache belongs to so that Apache
1237can execute it (don't add "other" execute permission!).
1238The permissions should look like this:
1239
1240    ls -l __CGIDIR__/BackupPC_Admin
1241    -swxr-x---    1 __BACKUPPCUSER__   web      82406 Jun 17 22:58 __CGIDIR__/BackupPC_Admin
1242
1243The setuid script won't work unless perl on your machine was installed
1244with setuid emulation.  This is likely the problem if you get an error
1245saying such as "Wrong user: my userid is 25, instead of 150", meaning
1246the script is running as the httpd user, not the BackupPC user.
1247This is because setuid scripts are disabled by the kernel in most
1248flavors of unix and linux.
1249
1250To see if your perl has setuid emulation, see if there is a program
1251called sperl5.8.0 (or sperl5.8.2 etc, based on your perl version)
1252in the place where perl is installed. If you can't find this program,
1253then you have two options: rebuild and reinstall perl with the setuid
1254emulation turned on (answer "y" to the question "Do you want to do
1255setuid/setgid emulation?" when you run perl's configure script), or
1256switch to the mod_perl alternative for the CGI script (which doesn't
1257need setuid to work).
1258
1259=item Mod_perl Setup
1260
1261The advantage of the mod_perl setup is that no setuid script is needed,
1262and there is a huge performance advantage.  Not only does all the perl
1263code need to be parsed just once, the config.pl and hosts files, plus
1264the connection to the BackupPC server are cached between requests.  The
1265typical speedup is around 15 times.
1266
1267To use mod_perl you need to run Apache as user __BACKUPPCUSER__.
1268If you need to run multiple Apache's for different services then
1269you need to create multiple top-level Apache directories, each
1270with their own config file.  You can make copies of /etc/init.d/httpd
1271and use the -d option to httpd to point each http to a different
1272top-level directory.  Or you can use the -f option to explicitly
1273point to the config file.  Multiple Apache's will run on different
1274Ports (eg: 80 is standard, 8080 is a typical alternative port accessed
1275via http://yourhost.com:8080).
1276
1277Inside BackupPC's Apache http.conf file you should check the
1278settings for ServerRoot, DocumentRoot, User, Group, and Port.  See
1279L<http://httpd.apache.org/docs/server-wide.html> for more details.
1280
1281For mod_perl, BackupPC_Admin should not have setuid permission, so
1282you should turn it off:
1283
1284    chmod u-s __CGIDIR__/BackupPC_Admin
1285
1286To tell Apache to use mod_perl to execute BackupPC_Admin, add this
1287to Apache's 1.x httpd.conf file:
1288
1289    <IfModule mod_perl.c>
1290	PerlModule Apache::Registry
1291	PerlTaintCheck On
1292	<Location /cgi-bin/BackupPC/BackupPC_Admin>   # <--- change path as needed
1293	   SetHandler perl-script
1294	   PerlHandler Apache::Registry
1295	   Options ExecCGI
1296	   PerlSendHeader On
1297	</Location>
1298    </IfModule>
1299
1300Apache 2.0.44 with Perl 5.8.0 on RedHat 7.1, Don Silvia reports that
1301this works (with tweaks from Michael Tuzi):
1302
1303    LoadModule perl_module modules/mod_perl.so
1304    PerlModule Apache2
1305
1306    <Directory /path/to/cgi/>
1307	SetHandler perl-script
1308	PerlResponseHandler ModPerl::Registry
1309	PerlOptions +ParseHeaders
1310	Options +ExecCGI
1311	Order deny,allow
1312	Deny from all
1313	Allow from 192.168.0
1314	AuthName "Backup Admin"
1315	AuthType Basic
1316	AuthUserFile /path/to/user_file
1317	Require valid-user
1318    </Directory>
1319
1320There are other optimizations and options with mod_perl.  For
1321example, you can tell mod_perl to preload various perl modules,
1322which saves memory compared to loading separate copies in every
1323Apache process after they are forked.  See Stas's definitive
1324mod_perl guide at L<http://perl.apache.org/guide>.
1325
1326=back
1327
1328BackupPC_Admin requires that users are authenticated by Apache.
1329Specifically, it expects that Apache sets the REMOTE_USER environment
1330variable when it runs.  There are several ways to do this.  One way
1331is to create a .htaccess file in the cgi-bin directory that looks like:
1332
1333    AuthGroupFile /etc/httpd/conf/group    # <--- change path as needed
1334    AuthUserFile /etc/http/conf/passwd     # <--- change path as needed
1335    AuthType basic
1336    AuthName "access"
1337    require valid-user
1338
1339You will also need "AllowOverride Indexes AuthConfig" in the Apache
1340httpd.conf file to enable the .htaccess file. Alternatively, everything
1341can go in the Apache httpd.conf file inside a Location directive. The
1342list of users and password file above can be extracted from the NIS
1343passwd file.
1344
1345One alternative is to use LDAP.  In Apache's http.conf add these lines:
1346
1347    LoadModule auth_ldap_module   modules/auth_ldap.so
1348    AddModule auth_ldap.c
1349
1350    # cgi-bin - auth via LDAP (for BackupPC)
1351    <Location /cgi-binBackupPC/BackupPC_Admin>    # <--- change path as needed
1352      AuthType Basic
1353      AuthName "BackupPC login"
1354      # replace MYDOMAIN, PORT, ORG and CO as needed
1355      AuthLDAPURL ldap://ldap.MYDOMAIN.com:PORT/o=ORG,c=CO?uid?sub?(objectClass=*)
1356      require valid-user
1357    </Location>
1358
1359If you want to disable the user authentication you can set
1360$Conf{CgiAdminUsers} to '*', which allows any user to have
1361full access to all hosts and backups.  In this case the REMOTE_USER
1362environment variable does not have to be set by Apache.
1363
1364Alternatively, you can force a particular user name by getting Apache
1365to set REMOTE_USER, eg, to hardcode the user to www you could add
1366this to Apache's httpd.conf:
1367
1368    <Location /cgi-bin/BackupPC/BackupPC_Admin>   # <--- change path as needed
1369        Setenv REMOTE_USER www
1370    </Location>
1371
1372Finally, you should also edit the config.pl file and adjust, as necessary,
1373the CGI-specific settings.  They're near the end of the config file. In
1374particular, you should specify which users or groups have administrator
1375(privileged) access: see the config settings $Conf{CgiAdminUserGroup}
1376and $Conf{CgiAdminUsers}.  Also, the configure.pl script placed various
1377images into $Conf{CgiImageDir} that BackupPC_Admin needs to serve
1378up.  You should make sure that $Conf{CgiImageDirURL} is the correct
1379URL for the image directory.
1380
1381See the section L<Fixing installation problems> for suggestions on debugging the Apache authentication setup.
1382
1383=head2 How BackupPC Finds Hosts
1384
1385Starting with v2.0.0 the way hosts are discovered has changed.  In most
1386cases you should specify 0 for the DHCP flag in the conf/hosts file,
1387even if the host has a dynamically assigned IP address.
1388
1389BackupPC (starting with v2.0.0) looks up hosts with DHCP = 0 in this manner:
1390
1391=over 4
1392
1393=item *
1394
1395First DNS is used to lookup the IP address given the client's name
1396using perl's gethostbyname() function.  This should succeed for machines
1397that have fixed IP addresses that are known via DNS.  You can manually
1398see whether a given host have a DNS entry according to perl's
1399gethostbyname function with this command:
1400
1401    perl -e 'print(gethostbyname("myhost") ? "ok\n" : "not found\n");'
1402
1403=item *
1404
1405If gethostbyname() fails, BackupPC then attempts a NetBios multicast to
1406find the host.  Provided your client machine is configured properly,
1407it should respond to this NetBios multicast request.  Specifically,
1408BackupPC runs a command of this form:
1409
1410    nmblookup myhost
1411
1412If this fails you will see output like:
1413
1414    querying myhost on 10.10.255.255
1415    name_query failed to find name myhost
1416
1417If it is successful you will see output like:
1418
1419    querying myhost on 10.10.255.255
1420    10.10.1.73 myhost<00>
1421
1422Depending on your netmask you might need to specify the -B option to
1423nmblookup.  For example:
1424
1425    nmblookup -B 10.10.1.255 myhost
1426
1427If necessary, experiment with the nmblookup command which will return the
1428IP address of the client given its name.  Then update
1429$Conf{NmbLookupFindHostCmd} with any necessary options to nmblookup.
1430
1431=back
1432
1433For hosts that have the DHCP flag set to 1, these machines are
1434discovered as follows:
1435
1436=over 4
1437
1438=item *
1439
1440A DHCP address pool ($Conf{DHCPAddressRanges}) needs to be specified.
1441BackupPC will check the NetBIOS name of each machine in the range using
1442a command of the form:
1443
1444    nmblookup -A W.X.Y.Z
1445
1446where W.X.Y.Z is each candidate address from $Conf{DHCPAddressRanges}.
1447Any host that has a valid NetBIOS name returned by this command (ie:
1448matching an entry in the hosts file) will be backed up.  You can
1449modify the specific nmblookup command if necessary via $Conf{NmbLookupCmd}.
1450
1451=item *
1452
1453You only need to use this DHCP feature if your client machine doesn't
1454respond to the NetBios multicast request:
1455
1456    nmblookup myHost
1457
1458but does respond to a request directed to its IP address:
1459
1460    nmblookup -A W.X.Y.Z
1461
1462=back
1463
1464=head2 Other installation topics
1465
1466=over 4
1467
1468=item Removing a client
1469
1470If there is a machine that no longer needs to be backed up (eg: a retired
1471machine) you have two choices.  First, you can keep the backups accessible
1472and browsable, but disable all new backups.  Alternatively, you can
1473completely remove the client and all its backups.
1474
1475To disable backups for a client $Conf{BackupsDisable} can be
1476set to two different values in that client's per-PC config.pl file:
1477
1478=over 4
1479
1480=item 1
1481
1482Don't do any regular backups on this machine.  Manually
1483requested backups (via the CGI interface) will still occur.
1484
1485=item 2
1486
1487Don't do any backups on this machine.  Manually requested
1488backups (via the CGI interface) will be ignored.
1489
1490=back
1491
1492This will still allow the client's old backups to be browsable
1493and restorable.
1494
1495To completely remove a client and all its backups, you should remove its
1496entry in the conf/hosts file, and then delete the __TOPDIR__/pc/$host
1497directory.  Whenever you change the hosts file, you should send
1498BackupPC a HUP (-1) signal so that it re-reads the hosts file.
1499If you don't do this, BackupPC will automatically re-read the
1500hosts file at the next regular wakeup.
1501
1502Note that when you remove a client's backups you won't initially
1503recover much disk space.  That's because the client's files are
1504still in the pool.  Overnight, when BackupPC_nightly next runs,
1505all the unused pool files will be deleted and this will recover
1506the disk space used by the client's backups.
1507
1508=item Copying the pool
1509
1510If the pool disk requirements grow you might need to copy the entire
1511data directory to a new (bigger) file system.  Hopefully you are lucky
1512enough to avoid this by having the data directory on a RAID file system
1513or LVM that allows the capacity to be grown in place by adding disks.
1514
1515The backup data directories contain large numbers of hardlinks.  If
1516you try to copy the pool the target directory will occupy a lot more
1517space if the hardlinks aren't re-established.
1518
1519The best way to copy a pool file system, if possible, is by copying
1520the raw device at the block level (eg: using dd).  Application level
1521programs that understand hardlinks include the GNU cp program with
1522the -a option and rsync -H.  However, the large number of hardlinks
1523in the pool will make the memory usage large and the copy very slow.
1524Don't forget to stop BackupPC while the copy runs.
1525
1526Starting in 3.0.0 a new script bin/BackupPC_tarPCCopy can be
1527used to assist the copy process.  Given one or more pc paths
1528(eg: TOPDIR/pc/HOST or TOPDIR/pc/HOST/nnn), BackupPC_tarPCCopy
1529creates a tar archive with all the hardlinks pointing to ../cpool/....
1530Any files not hardlinked (eg: backups, LOG etc) are included
1531verbatim.
1532
1533You will need to specify the -P option to tar when you extract
1534the archive generated by BackupPC_tarPCCopy since the hardlink
1535targets are outside of the directory being extracted.
1536
1537To copy a complete store (ie: __TOPDIR__) using BackupPC_tarPCCopy
1538you should:
1539
1540=over 4
1541
1542=item *
1543
1544stop BackupPC so that the store is static.
1545
1546=item *
1547
1548copy the cpool, conf and log directory trees using any technique
1549(like cp, rsync or tar) without the need to preserve hardlinks.
1550
1551=item *
1552
1553copy the pc directory using BackupPC_tarPCCopy:
1554
1555    su __BACKUPPCUSER__
1556    cd NEW_TOPDIR
1557    mkdir pc
1558    cd pc
1559    __INSTALLDIR__/bin/BackupPC_tarPCCopy __TOPDIR__/pc | tar xvPf -
1560
1561=back
1562
1563=back
1564
1565=head2 Fixing installation problems
1566
1567Please see the Wiki at L<http://backuppc.wiki.sourceforge.net> for
1568debugging suggestions.  If you find a solution to your problem that
1569could help other users please add it to the Wiki!
1570
1571=head1 Restore functions
1572
1573BackupPC supports several different methods for restoring files. The
1574most convenient restore options are provided via the CGI interface.
1575Alternatively, backup files can be restored using manual commands.
1576
1577=head2 CGI restore options
1578
1579By selecting a host in the CGI interface, a list of all the backups
1580for that machine will be displayed.  By selecting the backup number
1581you can navigate the shares and directory tree for that backup.
1582
1583BackupPC's CGI interface automatically fills incremental backups
1584with the corresponding full backup, which means each backup has
1585a filled appearance.  Therefore, there is no need to do multiple
1586restores from the incremental and full backups: BackupPC does all
1587the hard work for you.  You simply select the files and directories
1588you want from the correct backup vintage in one step.
1589
1590You can download a single backup file at any time simply by selecting
1591it.  Your browser should prompt you with the file name and ask you
1592whether to open the file or save it to disk.
1593
1594Alternatively, you can select one or more files or directories in
1595the currently selected directory and select "Restore selected files".
1596(If you need to restore selected files and directories from several
1597different parent directories you will need to do that in multiple
1598steps.)
1599
1600If you select all the files in a directory, BackupPC will replace
1601the list of files with the parent directory.  You will be presented
1602with a screen that has three options:
1603
1604=over 4
1605
1606=item Option 1: Direct Restore
1607
1608With this option the selected files and directories are restored
1609directly back onto the host, by default in their original location.
1610Any old files with the same name will be overwritten, so use caution.
1611You can optionally change the target host name, target share name,
1612and target path prefix for the restore, allowing you to restore the
1613files to a different location.
1614
1615Once you select "Start Restore" you will be prompted one last time
1616with a summary of the exact source and target files and directories
1617before you commit.  When you give the final go ahead the restore
1618operation will be queued like a normal backup job, meaning that it
1619will be deferred if there is a backup currently running for that host.
1620When the restore job is run, smbclient, tar, rsync or rsyncd is used
1621(depending upon $Conf{XferMethod}) to actually restore the files.
1622Sorry, there is currently no option to cancel a restore that has been
1623started.  Currently ftp restores are not fully implemented.
1624
1625A record of the restore request, including the result and list of
1626files and directories, is kept.  It can be browsed from the host's
1627home page.  $Conf{RestoreInfoKeepCnt} specifies how many old restore
1628status files to keep.
1629
1630Note that for direct restore to work, the $Conf{XferMethod} must
1631be able to write to the client.  For example, that means an SMB
1632share for smbclient needs to be writable, and the rsyncd module
1633needs "read only" set to "false".  This creates additional security
1634risks.  If you only create read-only SMB shares (which is a good
1635idea), then the direct restore will fail.  You can disable the
1636direct restore option by setting $Conf{SmbClientRestoreCmd},
1637$Conf{TarClientRestoreCmd} and $Conf{RsyncRestoreArgs} to undef.
1638
1639=item Option 2: Download Zip archive
1640
1641With this option a zip file containing the selected files and directories
1642is downloaded.  The zip file can then be unpacked or individual files
1643extracted as necessary on the host machine. The compression level can be
1644specified.  A value of 0 turns off compression.
1645
1646When you select "Download Zip File" you should be prompted where to
1647save the restore.zip file.
1648
1649BackupPC does not consider downloading a zip file as an actual
1650restore operation, so the details are not saved for later browsing
1651as in the first case.  However, a mention that a zip file was
1652downloaded by a particular user, and a list of the files, does
1653appear in BackupPC's log file.
1654
1655=item Option 3: Download Tar archive
1656
1657This is identical to the previous option, except a tar file is downloaded
1658rather than a zip file (and there is currently no compression option).
1659
1660=back
1661
1662=head2 Command-line restore options
1663
1664Apart from the CGI interface, BackupPC allows you to restore files
1665and directories from the command line.  The following programs can
1666be used:
1667
1668=over 4
1669
1670=item BackupPC_zcat
1671
1672For each file name argument it inflates (uncompresses) the file and
1673writes it to stdout.  To use BackupPC_zcat you could give it the
1674full file name, eg:
1675
1676    __INSTALLDIR__/bin/BackupPC_zcat __TOPDIR__/pc/host/5/fc/fcraig/fexample.txt > example.txt
1677
1678It's your responsibility to make sure the file is really compressed:
1679BackupPC_zcat doesn't check which backup the requested file is from.
1680BackupPC_zcat returns a non-zero status if it fails to uncompress
1681a file.
1682
1683=item BackupPC_tarCreate
1684
1685BackupPC_tarCreate creates a tar file for any files or directories in
1686a particular backup.  Merging of incrementals is done automatically,
1687so you don't need to worry about whether certain files appear in the
1688incremental or full backup.
1689
1690The usage is:
1691
1692    BackupPC_tarCreate [options] files/directories...
1693    Required options:
1694       -h host         host from which the tar archive is created
1695       -n dumpNum      dump number from which the tar archive is created
1696                       A negative number means relative to the end (eg -1
1697                       means the most recent dump, -2 2nd most recent etc).
1698       -s shareName    share name from which the tar archive is created
1699
1700    Other options:
1701       -t              print summary totals
1702       -r pathRemove   path prefix that will be replaced with pathAdd
1703       -p pathAdd      new path prefix
1704       -b BLOCKS       BLOCKS x 512 bytes per record (default 20; same as tar)
1705       -w writeBufSz   write buffer size (default 1048576 = 1MB)
1706       -e charset      charset for encoding file names (default: value of
1707                       $Conf{ClientCharset} when backup was done)
1708       -l              just print a file listing; don't generate an archive
1709       -L              just print a detailed file listing; don't generate an archive
1710
1711The command-line files and directories are relative to the specified
1712shareName.  The tar file is written to stdout.
1713
1714The -h, -n and -s options specify which dump is used to generate
1715the tar archive.  The -r and -p options can be used to relocate
1716the paths in the tar archive so extracted files can be placed
1717in a location different from their original location.
1718
1719=item BackupPC_zipCreate
1720
1721BackupPC_zipCreate creates a zip file for any files or directories in
1722a particular backup.  Merging of incrementals is done automatically,
1723so you don't need to worry about whether certain files appear in the
1724incremental or full backup.
1725
1726The usage is:
1727
1728    BackupPC_zipCreate [options] files/directories...
1729    Required options:
1730       -h host         host from which the zip archive is created
1731       -n dumpNum      dump number from which the tar archive is created
1732                       A negative number means relative to the end (eg -1
1733                       means the most recent dump, -2 2nd most recent etc).
1734       -s shareName    share name from which the zip archive is created
1735
1736    Other options:
1737       -t              print summary totals
1738       -r pathRemove   path prefix that will be replaced with pathAdd
1739       -p pathAdd      new path prefix
1740       -c level        compression level (default is 0, no compression)
1741       -e charset      charset for encoding file names (default: utf8)
1742
1743The command-line files and directories are relative to the specified
1744shareName.  The zip file is written to stdout. The -h, -n and -s
1745options specify which dump is used to generate the zip archive.  The
1746-r and -p options can be used to relocate the paths in the zip archive
1747so extracted files can be placed in a location different from their
1748original location.
1749
1750=back
1751
1752Each of these programs reside in __INSTALLDIR__/bin.
1753
1754=head1 Archive functions
1755
1756BackupPC supports archiving to removable media. For users that require
1757offsite backups, BackupPC can create archives that stream to tape
1758devices, or create files of specified sizes to fit onto cd or dvd media.
1759
1760Each archive type is specified by a BackupPC host with its XferMethod
1761set to 'archive'. This allows for multiple configurations at sites where
1762there might be a combination of tape and cd/dvd backups being made.
1763
1764BackupPC provides a menu that allows one or more hosts to be archived.
1765The most recent backup of each host is archived using BackupPC_tarCreate,
1766and the output is optionally compressed and split into fixed-sized
1767files (eg: 650MB).
1768
1769The archive for each host is done by default using
1770__INSTALLDIR__/bin/BackupPC_archiveHost.  This script can be copied
1771and customized as needed.
1772
1773=head2 Configuring an Archive Host
1774
1775To create an Archive Host, add it to the hosts file just as any other host
1776and call it a name that best describes the type of archive, e.g. ArchiveDLT
1777
1778To tell BackupPC that the Host is for Archives, create a config.pl file in
1779the Archive Hosts's pc directory, adding the following line:
1780
1781$Conf{XferMethod} = 'archive';
1782
1783To further customise the archive's parameters you can adding the changed
1784parameters in the host's config.pl file. The parameters are explained in
1785the config.pl file.  Parameters may be fixed or the user can be allowed
1786to change them (eg: output device).
1787
1788The per-host archive command is $Conf{ArchiveClientCmd}.  By default
1789this invokes
1790
1791     __INSTALLDIR__/bin/BackupPC_archiveHost
1792
1793which you can copy and customize as necessary.
1794
1795=head2 Starting an Archive
1796
1797In the web interface, click on the Archive Host you wish to use. You will see a
1798list of previous archives and a summary on each. By clicking the "Start Archive"
1799button you are presented with the list of hosts and the approximate backup size
1800(note this is raw size, not projected compressed size) Select the hosts you wish
1801to archive and press the "Archive Selected Hosts" button.
1802
1803The next screen allows you to adjust the parameters for this archive run.
1804Press the "Start the Archive" to start archiving the selected hosts with the
1805parameters displayed.
1806
1807=head2 Starting an Archive from the command line
1808
1809The script BackupPC_archiveStart can be used to start an archive from
1810the command line (or cron etc).  The usage is:
1811
1812    BackupPC_archiveStart archiveHost userName hosts...
1813
1814This creates an archive of the most recent backup of each of
1815the specified hosts.  The first two arguments are the archive
1816host and the user name making the request.
1817
1818=head1 Other CGI Functions
1819
1820=head2 Configuration and Host Editor
1821
1822The CGI interface has a complete configuration and host editor.
1823Only the administrator can edit the main configuration settings
1824and hosts.  The edit links are in the left navigation bar.
1825
1826When changes are made to any parameter a "Save" button appears
1827at the top of the page.  If you are editing a text box you will
1828need to click outside of the text box to make the Save button
1829appear.  If you don't select Save then the changes won't be saved.
1830
1831The host-specific configuration can be edited from the host
1832summary page using the link in the left navigation bar.
1833The administrator can edit any of the host-specific
1834configuration settings.
1835
1836When editing the host-specific configuration, each parameter has
1837an "override" setting that denotes the value is host-specific,
1838meaning that it overrides the setting in the main configuration.
1839If you unselect "override" then the setting is removed from
1840the host-specific configuration, and the main configuration
1841file is displayed.
1842
1843User's can edit their host-specific configuration if enabled
1844via $Conf{CgiUserConfigEditEnable}.  The specific subset
1845of configuration settings that a user can edit is specified
1846with $Conf{CgiUserConfigEdit}.  It is recommended to make this
1847list short as possible (you probably don't want your users saving
1848dozens of backups) and it is essential that they can't edit any
1849of the Cmd configuration settings, otherwise they can specify
1850an arbitrary command that will be executed as the BackupPC
1851user.
1852
1853=head2 RSS
1854
1855BackupPC supports a very basic RSS feed.  Provided you have the
1856XML::RSS perl module installed, a URL similar to this will
1857provide RSS information:
1858
1859    http://localhost/cgi-bin/BackupPC/BackupPC_Admin?action=rss
1860
1861This feature is experimental.  The information included will
1862probably change.
1863
1864=head1 BackupPC Design
1865
1866=head2 Some design issues
1867
1868=over 4
1869
1870=item Pooling common files
1871
1872To quickly see if a file is already in the pool, an MD5 digest of the
1873file length and contents is used as the file name in the pool. This
1874can't guarantee a file is identical: it just reduces the search to
1875often a single file or handful of files. A complete file comparison
1876is always done to verify if two files are really the same.
1877
1878Identical files on multiples backups are represented by hard links.
1879Hardlinks are used so that identical files all refer to the same
1880physical file on the server's disk. Also, hard links maintain
1881reference counts so that BackupPC knows when to delete unused files
1882from the pool.
1883
1884For the computer-science majors among you, you can think of the pooling
1885system used by BackupPC as just a chained hash table stored on a (big)
1886file system.
1887
1888=item The hashing function
1889
1890There is a tradeoff between how much of file is used for the MD5 digest
1891and the time taken comparing all the files that have the same hash.
1892
1893Using the file length and just the first 4096 bytes of the file for the
1894MD5 digest produces some repetitions.  One example: with 900,000 unique
1895files in the pool, this hash gives about 7,000 repeated files, and in
1896the worst case 500 files have the same hash.  That's not bad: we only
1897have to do a single file compare 99.2% of the time.  But in the worst
1898case we have to compare as many as 500 files checking for a match.
1899
1900With a modest increase in CPU time, if we use the file length and the
1901first 256K of the file we now only have 500 repeated files and in the
1902worst case around 20 files have the same hash. Furthermore, if we
1903instead use the first and last 128K of the file (more specifically, the
1904first and eighth 128K chunks for files larger than 1MB) we get only 300
1905repeated files and in the worst case around 20 files have the same hash.
1906
1907Based on this experimentation, this is the hash function used by BackupPC.
1908It is important that you don't change the hash function after files
1909are already in the pool.  Otherwise your pool will grow to twice the
1910size until all the old backups (and all the old files with old hashes)
1911eventually expire.
1912
1913=item Compression
1914
1915BackupPC supports compression. It uses the deflate and inflate methods
1916in the Compress::Zlib module, which is based on the zlib compression
1917library (see L<http://www.gzip.org/zlib/>).
1918
1919The $Conf{CompressLevel} setting specifies the compression level to use.
1920Zero (0) means no compression. Compression levels can be from 1 (least
1921cpu time, slightly worse compression) to 9 (most cpu time, slightly
1922better compression). The recommended value is 3. Changing it to 5, for
1923example, will take maybe 20% more cpu time and will get another 2-3%
1924additional compression. Diminishing returns set in above 5.  See the zlib
1925documentation for more information about compression levels.
1926
1927BackupPC implements compression with minimal CPU load. Rather than
1928compressing every incoming backup file and then trying to match it
1929against the pool, BackupPC computes the MD5 digest based on the
1930uncompressed file, and matches against the candidate pool files by
1931comparing each uncompressed pool file against the incoming backup file.
1932Since inflating a file takes roughly a factor of 10 less CPU time than
1933deflating there is a big saving in CPU time.
1934
1935The combination of pooling common files and compression can yield
1936a factor of 8 or more overall saving in backup storage.
1937
1938=back
1939
1940=head2 BackupPC operation
1941
1942BackupPC reads the configuration information from
1943__CONFDIR__/config.pl. It then runs and manages all the backup
1944activity. It maintains queues of pending backup requests, user backup
1945requests and administrative commands. Based on the configuration various
1946requests will be executed simultaneously.
1947
1948As specified by $Conf{WakeupSchedule}, BackupPC wakes up periodically
1949to queue backups on all the PCs.  This is a four step process:
1950
1951=over 4
1952
1953=item 1
1954
1955For each host and DHCP address backup requests are queued on the
1956background command queue.
1957
1958=item 2
1959
1960For each PC, BackupPC_dump is forked. Several of these may be run in
1961parallel, based on the configuration. First a ping is done to see if
1962the machine is alive. If this is a DHCP address, nmblookup is run to
1963get the netbios name, which is used as the host name. If DNS lookup
1964fails, $Conf{NmbLookupFindHostCmd} is run to find the IP address from
1965the host name.  The file __TOPDIR__/pc/$host/backups is read to decide
1966whether a full or incremental backup needs to be run. If no backup is
1967scheduled, or the ping to $host fails, then BackupPC_dump exits.
1968
1969The backup is done using the specified XferMethod.  Either samba's smbclient
1970or tar over ssh/rsh/nfs piped into BackupPC_tarExtract, or rsync over ssh/rsh
1971is run, or rsyncd is connected to, with the incoming data
1972extracted to __TOPDIR__/pc/$host/new.  The XferMethod output is put
1973into __TOPDIR__/pc/$host/XferLOG.
1974
1975The letter in the XferLOG file shows the type of object, similar to the
1976first letter of the modes displayed by ls -l:
1977
1978    d -> directory
1979    l -> symbolic link
1980    b -> block special file
1981    c -> character special file
1982    p -> pipe file (fifo)
1983    nothing -> regular file
1984
1985The words mean:
1986
1987=over 4
1988
1989=item create
1990
1991new for this backup (ie: directory or file not in pool)
1992
1993=item pool
1994
1995found a match in the pool
1996
1997=item same
1998
1999file is identical to previous backup (contents were
2000checksummed and verified during full dump).
2001
2002=item skip
2003
2004file skipped in incremental because attributes are the
2005same (only displayed if $Conf{XferLogLevel} >= 2).
2006
2007=back
2008
2009As BackupPC_tarExtract extracts the files from smbclient or tar, or as
2010rsync or ftp runs, it checks each file in the backup to see if it is
2011identical to an existing file from any previous backup of any PC. It
2012does this without needed to write the file to disk. If the file matches
2013an existing file, a hardlink is created to the existing file in the
2014pool. If the file does not match any existing files, the file is written
2015to disk and the file name is saved in __TOPDIR__/pc/$host/NewFileList
2016for later processing by BackupPC_link.  BackupPC_tarExtract and rsync
2017can handle arbitrarily large files and multiple candidate matching files
2018without needing to write the file to disk in the case of a match.  This
2019significantly reduces disk writes (and also reads, since the pool file
2020comparison is done disk to memory, rather than disk to disk).
2021
2022Based on the configuration settings, BackupPC_dump checks each
2023old backup to see if any should be removed.  Any expired backups
2024are moved to __TOPDIR__/trash for later removal by BackupPC_trashClean.
2025
2026=item 3
2027
2028For each complete, good, backup, BackupPC_link is run.
2029To avoid race conditions as new files are linked into the
2030pool area, only a single BackupPC_link program runs
2031at a time and the rest are queued.
2032
2033BackupPC_link reads the NewFileList written by BackupPC_dump and
2034inspects each new file in the backup. It re-checks if there is a
2035matching file in the pool (another BackupPC_link
2036could have added the file since BackupPC_dump checked). If so, the file
2037is removed and replaced by a hard link to the existing file. If the file
2038is new, a hard link to the file is made in the pool area, so that this
2039file is available for checking against each new file and new backup.
2040
2041Then, if $Conf{IncrFill} is set (note that the default setting is
2042off), for each incremental backup, hard links are made in the new
2043backup to all files that were not extracted during the incremental
2044backups.  The means the incremental backup looks like a complete
2045image of the PC (with the exception that files that were removed on
2046the PC since the last full backup will still appear in the backup
2047directory tree).
2048
2049The CGI interface knows how to merge unfilled incremental backups will
2050the most recent prior filled (full) backup, giving the incremental
2051backups a filled appearance.  The default for $Conf{IncrFill} is off,
2052since there is no need to fill incremental backups.  This saves
2053some level of disk activity, since lots of extra hardlinks are no
2054longer needed (and don't have to be deleted when the backup expires).
2055
2056=item 4
2057
2058BackupPC_trashClean is always run in the background to remove any
2059expired backups. Every 5 minutes it wakes up and removes all the files
2060in __TOPDIR__/trash.
2061
2062Also, once each night, BackupPC_nightly is run to complete some
2063additional administrative tasks, such as cleaning the pool.  This
2064involves removing any files in the pool that only have a single
2065hard link (meaning no backups are using that file).  Again, to
2066avoid race conditions, BackupPC_nightly is only run when there
2067are no BackupPC_link processes running.  When BackupPC_nightly is
2068run no new BackupPC_link jobs are started.  If BackupPC_nightly
2069takes too long to run, the settings $Conf{MaxBackupPCNightlyJobs}
2070and $Conf{BackupPCNightlyPeriod} can be used to run several
2071BackupPC_nightly processes in parallel, and to split its job over
2072several nights.
2073
2074=back
2075
2076BackupPC also listens for TCP connections on $Conf{ServerPort}, which
2077is used by the CGI script BackupPC_Admin for status reporting and
2078user-initiated backup or backup cancel requests.
2079
2080=head2 Storage layout
2081
2082BackupPC resides in several directories:
2083
2084=over 4
2085
2086=item __INSTALLDIR__
2087
2088Perl scripts comprising BackupPC reside in __INSTALLDIR__/bin,
2089libraries are in __INSTALLDIR__/lib and documentation
2090is in __INSTALLDIR__/doc.
2091
2092=item __CGIDIR__
2093
2094The CGI script BackupPC_Admin resides in this cgi binary directory.
2095
2096=item __CONFDIR__
2097
2098All the configuration information resides below __CONFDIR__.
2099This directory contains:
2100
2101The directory __CONFDIR__ contains:
2102
2103=over 4
2104
2105=item config.pl
2106
2107Configuration file. See L<Configuration File> below for more details.
2108
2109=item hosts
2110
2111Hosts file, which lists all the PCs to backup.
2112
2113=item pc
2114
2115The directory __CONFDIR__/pc contains per-client configuration files
2116that override settings in the main configuration file.  Each file
2117is named __CONFDIR__/pc/HOST.pl, where HOST is the host name.
2118
2119In pre-FHS versions of BackupPC these files were located in
2120__TOPDIR__/pc/HOST/config.pl.
2121
2122=back
2123
2124=item __LOGDIR__
2125
2126The directory __LOGDIR__ (__TOPDIR__/log on pre-FHS versions
2127of BackupPC) contains:
2128
2129=over 4
2130
2131=item LOG
2132
2133Current (today's) log file output from BackupPC.
2134
2135=item LOG.0 or LOG.0.z
2136
2137Yesterday's log file output.  Log files are aged daily and compressed
2138(if compression is enabled), and old LOG files are deleted.
2139
2140=item BackupPC.pid
2141
2142Contains BackupPC's process id.
2143
2144=item status.pl
2145
2146A summary of BackupPC's status written periodically by BackupPC so
2147that certain state information can be maintained if BackupPC is
2148restarted.  Should not be edited.
2149
2150=item UserEmailInfo.pl
2151
2152A summary of what email was last sent to each user, and when the
2153last email was sent.  Should not be edited.
2154
2155=back
2156
2157=item __TOPDIR__
2158
2159All of BackupPC's data (PC backup images, logs, configuration information)
2160is stored below this directory.
2161
2162Below __TOPDIR__ are several directories:
2163
2164=over 4
2165
2166=item __TOPDIR__/trash
2167
2168Any directories and files below this directory are periodically deleted
2169whenever BackupPC_trashClean checks. When a backup is aborted or when an
2170old backup expires, BackupPC_dump simply moves the directory to
2171__TOPDIR__/trash for later removal by BackupPC_trashClean.
2172
2173=item __TOPDIR__/pool
2174
2175All uncompressed files from PC backups are stored below __TOPDIR__/pool.
2176Each file's name is based on the MD5 hex digest of the file contents.
2177Specifically, for files less than 256K, the file length and the entire
2178file is used. For files up to 1MB, the file length and the first and
2179last 128K are used. Finally, for files longer than 1MB, the file length,
2180and the first and eighth 128K chunks for the file are used.
2181
2182Each file is stored in a subdirectory X/Y/Z, where X, Y, Z are the
2183first 3 hex digits of the MD5 digest.
2184
2185For example, if a file has an MD5 digest of 123456789abcdef0,
2186the file is stored in __TOPDIR__/pool/1/2/3/123456789abcdef0.
2187
2188The MD5 digest might not be unique (especially since not all the file's
2189contents are used for files bigger than 256K). Different files that have
2190the same MD5 digest are stored with a trailing suffix "_n" where n is
2191an incrementing number starting at 0. So, for example, if two additional
2192files were identical to the first, except the last byte was different,
2193and assuming the file was larger than 1MB (so the MD5 digests are the
2194same but the files are actually different), the three files would be
2195stored as:
2196
2197	__TOPDIR__/pool/1/2/3/123456789abcdef0
2198	__TOPDIR__/pool/1/2/3/123456789abcdef0_0
2199	__TOPDIR__/pool/1/2/3/123456789abcdef0_1
2200
2201Both BackupPC_dump (actually, BackupPC_tarExtract) and BackupPC_link are
2202responsible for checking newly backed up files against the pool. For
2203each file, the MD5 digest is used to generate a file name in the pool
2204directory. If the file exists in the pool, the contents are compared.
2205If there is no match, additional files ending in "_n" are checked.
2206(Actually, BackupPC_tarExtract compares multiple candidate files in
2207parallel.)  If the file contents exactly match, the file is created by
2208simply making a hard link to the pool file (this is done by
2209BackupPC_tarExtract as the backup proceeds). Otherwise,
2210BackupPC_tarExtract writes the new file to disk and a new hard link is
2211made in the pool to the file (this is done later by BackupPC_link).
2212
2213Therefore, every file in the pool will have at least 2 hard links
2214(one for the pool file and one for the backup file below __TOPDIR__/pc).
2215Identical files from different backups or PCs will all be linked to
2216the same file.  When old backups are deleted, some files in the pool
2217might only have one link.  BackupPC_nightly checks the entire pool
2218and removes all files that have only a single link, thereby recovering
2219the storage for that file.
2220
2221One other issue: zero length files are not pooled, since there are a lot
2222of these files and on most file systems it doesn't save any disk space
2223to turn these files into hard links.
2224
2225=item __TOPDIR__/cpool
2226
2227All compressed files from PC backups are stored below __TOPDIR__/cpool.
2228Its layout is the same as __TOPDIR__/pool, and the hashing function
2229is the same (and, importantly, based on the uncompressed file, not
2230the compressed file).
2231
2232=item __TOPDIR__/pc/$host
2233
2234For each PC $host, all the backups for that PC are stored below
2235the directory __TOPDIR__/pc/$host.  This directory contains the
2236following files:
2237
2238=over 4
2239
2240=item LOG
2241
2242Current log file for this PC from BackupPC_dump.
2243
2244=item LOG.DDMMYYYY or LOG.DDMMYYYY.z
2245
2246Last month's log file.  Log files are aged monthly and compressed
2247(if compression is enabled), and old LOG files are deleted.
2248In earlier versions of BackupPC these files used to have
2249a suffix of 0, 1, ....
2250
2251=item XferERR or XferERR.z
2252
2253Output from the transport program (ie: smbclient, tar, rsync or ftp)
2254for the most recent failed backup.
2255
2256=item new
2257
2258Subdirectory in which the current backup is stored.  This
2259directory is renamed if the backup succeeds.
2260
2261=item XferLOG or XferLOG.z
2262
2263Output from the transport program (ie: smbclient, tar, rsync or ftp)
2264for the current backup.
2265
2266=item nnn (an integer)
2267
2268Successful backups are in directories numbered sequentially starting at 0.
2269
2270=item XferLOG.nnn or XferLOG.nnn.z
2271
2272Output from the transport program (ie: smbclient, tar, rsync or ftp)
2273corresponding to backup number nnn.
2274
2275=item RestoreInfo.nnn
2276
2277Information about restore request #nnn including who, what, when, and
2278why. This file is in Data::Dumper format.  (Note that the restore
2279numbers are not related to the backup number.)
2280
2281=item RestoreLOG.nnn.z
2282
2283Output from smbclient, tar or rsync during restore #nnn.  (Note that the restore
2284numbers are not related to the backup number.)
2285
2286=item ArchiveInfo.nnn
2287
2288Information about archive request #nnn including who, what, when, and
2289why. This file is in Data::Dumper format.  (Note that the archive
2290numbers are not related to the restore or backup number.)
2291
2292=item ArchiveLOG.nnn.z
2293
2294Output from archive #nnn.  (Note that the archive numbers are not related
2295to the backup or restore number.)
2296
2297=item config.pl
2298
2299Old location of optional configuration settings specific to this host.
2300Settings in this file override the main configuration file.
2301In new versions of BackupPC the per-host configuration files are
2302stored in __CONFDIR__/pc/HOST.pl.
2303
2304=item backups
2305
2306A tab-delimited ascii table listing information about each successful
2307backup, one per row.  The columns are:
2308
2309=over 4
2310
2311=item num
2312
2313The backup number, an integer that starts at 0 and increments
2314for each successive backup.  The corresponding backup is stored
2315in the directory num (eg: if this field is 5, then the backup is
2316stored in __TOPDIR__/pc/$host/5).
2317
2318=item type
2319
2320Set to "full" or "incr" for full or incremental backup.
2321
2322=item startTime
2323
2324Start time of the backup in unix seconds.
2325
2326=item endTime
2327
2328Stop time of the backup in unix seconds.
2329
2330=item nFiles
2331
2332Number of files backed up (as reported by smbclient, tar, rsync or ftp).
2333
2334=item size
2335
2336Total file size backed up (as reported by smbclient, tar, rsync or ftp).
2337
2338=item nFilesExist
2339
2340Number of files that were already in the pool
2341(as determined by BackupPC_dump and BackupPC_link).
2342
2343=item sizeExist
2344
2345Total size of files that were already in the pool
2346(as determined by BackupPC_dump and BackupPC_link).
2347
2348=item nFilesNew
2349
2350Number of files that were not in the pool
2351(as determined by BackupPC_link).
2352
2353=item sizeNew
2354
2355Total size of files that were not in the pool
2356(as determined by BackupPC_link).
2357
2358=item xferErrs
2359
2360Number of errors or warnings from smbclient, tar, rsync or ftp.
2361
2362=item xferBadFile
2363
2364Number of errors from smbclient that were bad file errors (zero otherwise).
2365
2366=item xferBadShare
2367
2368Number of errors from smbclient that were bad share errors (zero otherwise).
2369
2370=item tarErrs
2371
2372Number of errors from BackupPC_tarExtract.
2373
2374=item compress
2375
2376The compression level used on this backup.  Zero or empty means no
2377compression.
2378
2379=item sizeExistComp
2380
2381Total compressed size of files that were already in the pool
2382(as determined by BackupPC_dump and BackupPC_link).
2383
2384=item sizeNewComp
2385
2386Total compressed size of files that were not in the pool
2387(as determined by BackupPC_link).
2388
2389=item noFill
2390
2391Set if this backup has not been filled in with the most recent
2392previous filled or full backup.  See $Conf{IncrFill}.
2393
2394=item fillFromNum
2395
2396If this backup was filled (ie: noFill is 0) then this is the
2397number of the backup that it was filled from
2398
2399=item mangle
2400
2401Set if this backup has mangled file names and attributes.  Always
2402true for backups in v1.4.0 and above.  False for all backups prior
2403to v1.4.0.
2404
2405=item xferMethod
2406
2407Set to the value of $Conf{XferMethod} when this dump was done.
2408
2409=item level
2410
2411The level of this dump.  A full dump is level 0.  Currently incrementals
2412are 1.  But when multi-level incrementals are supported this will reflect
2413each dump's incremental level.
2414
2415=back
2416
2417=item restores
2418
2419A tab-delimited ascii table listing information about each requested
2420restore, one per row.  The columns are:
2421
2422=over 4
2423
2424=item num
2425
2426Restore number (matches the suffix of the RestoreInfo.nnn and
2427RestoreLOG.nnn.z file), unrelated to the backup number.
2428
2429=item startTime
2430
2431Start time of the restore in unix seconds.
2432
2433=item endTime
2434
2435End time of the restore in unix seconds.
2436
2437=item result
2438
2439Result (ok or failed).
2440
2441=item errorMsg
2442
2443Error message if restore failed.
2444
2445=item nFiles
2446
2447Number of files restored.
2448
2449=item size
2450
2451Size in bytes of the restored files.
2452
2453=item tarCreateErrs
2454
2455Number of errors from BackupPC_tarCreate during restore.
2456
2457=item xferErrs
2458
2459Number of errors from smbclient, tar, rsync or ftp during restore.
2460
2461=back
2462
2463=item archives
2464
2465A tab-delimited ascii table listing information about each requested
2466archive, one per row.  The columns are:
2467
2468=over 4
2469
2470=item num
2471
2472Archive number (matches the suffix of the ArchiveInfo.nnn and
2473ArchiveLOG.nnn.z file), unrelated to the backup or restore number.
2474
2475=item startTime
2476
2477Start time of the restore in unix seconds.
2478
2479=item endTime
2480
2481End time of the restore in unix seconds.
2482
2483=item result
2484
2485Result (ok or failed).
2486
2487=item errorMsg
2488
2489Error message if archive failed.
2490
2491=back
2492
2493=back
2494
2495=back
2496
2497=back
2498
2499=head2 Compressed file format
2500
2501The compressed file format is as generated by Compress::Zlib::deflate
2502with one minor, but important, tweak. Since Compress::Zlib::inflate
2503fully inflates its argument in memory, it could take large amounts of
2504memory if it was inflating a highly compressed file. For example, a
2505200MB file of 0x0 bytes compresses to around 200K bytes. If
2506Compress::Zlib::inflate was called with this single 200K buffer, it
2507would need to allocate 200MB of memory to return the result.
2508
2509BackupPC watches how efficiently a file is compressing. If a big file
2510has very high compression (meaning it will use too much memory when it
2511is inflated), BackupPC calls the flush() method, which gracefully
2512completes the current compression.  BackupPC then starts another
2513deflate and simply appends the output file.  So the BackupPC compressed
2514file format is one or more concatenated deflations/flushes.  The specific
2515ratios that BackupPC uses is that if a 6MB chunk compresses to less
2516than 64K then a flush will be done.
2517
2518Back to the example of the 200MB file of 0x0 bytes.  Adding flushes
2519every 6MB adds only 200 or so bytes to the 200K output.  So the
2520storage cost of flushing is negligible.
2521
2522To easily decompress a BackupPC compressed file, the script
2523BackupPC_zcat can be found in __INSTALLDIR__/bin.  For each
2524file name argument it inflates the file and writes it to stdout.
2525
2526=head2 Rsync checksum caching
2527
2528An incremental backup with rsync compares attributes on the client
2529with the last full backup.  Any files with identical attributes
2530are skipped.  A full backup with rsync sets the --ignore-times
2531option, which causes every file to be examined independent of
2532attributes.
2533
2534Each file is examined by generating block checksums (default 2K
2535blocks) on the receiving side (that's the BackupPC side), sending
2536those checksums to the client, where the remote rsync matches those
2537checksums with the corresponding file.  The matching blocks and new
2538data is sent back, allowing the client file to be reassembled.
2539A checksum for the entire file is sent to as an extra check the
2540the reconstructed file is correct.
2541
2542This results in significant disk IO and computation for BackupPC:
2543every file in a full backup, or any file with non-matching attributes
2544in an incremental backup, needs to be uncompressed, block checksums
2545computed and sent.  Then the receiving side reassembles the file and
2546has to verify the whole-file checksum.  Even if the file is identical,
2547prior to 2.1.0, BackupPC had to read and uncompress the file twice,
2548once to compute the block checksums and later to verify the whole-file
2549checksum.
2550
2551Starting in 2.1.0, BackupPC supports optional checksum caching,
2552which means the block and file checksums only need to be computed
2553once for each file.  This results in a significant performance
2554improvement.  This only works for compressed pool files.
2555It is enabled by adding
2556
2557	'--checksum-seed=32761',
2558
2559to $Conf{RsyncArgs} and $Conf{RsyncRestoreArgs}.
2560
2561Rsync versions prior to and including rsync-2.6.2 need a small patch to
2562add support for the --checksum-seed option.  This patch is available in
2563the cygwin-rsyncd package at L<http://backuppc.sourceforge.net>.
2564This patch is already included in rsync CVS, so it will be standard
2565in future versions of rsync.
2566
2567When this option is present, BackupPC will add block and file checksums
2568to the compressed pool file the next time a pool file is used and it
2569doesn't already have cached checksums.  The first time a new file is
2570written to the pool, the checksums are not appended.  The next time
2571checksums are needed for a file, they are computed and added.  So the
2572full performance benefit of checksum caching won't be noticed until the
2573third time a pool file is used (eg: the third full backup).
2574
2575With checksum caching enabled, there is a risk that should a file's contents
2576in the pool be corrupted due to a disk problem, but the cached checksums
2577are still correct, the corruption will not be detected by a full backup,
2578since the file contents are no longer read and compared.  To reduce the
2579chance that this remains undetected, BackupPC can recheck cached checksums
2580for a fraction of the files.  This fraction is set with the
2581$Conf{RsyncCsumCacheVerifyProb} setting.  The default value of 0.01 means
2582that 1% of the time a file's checksums are read, the checksums are verified.
2583This reduces performance slightly, but, over time, ensures that files
2584contents are in sync with the cached checksums.
2585
2586The format of the cached checksum data can be discovered by looking at
2587the code.  Basically, the first byte of the compressed file is changed
2588to denote that checksums are appended.  The block and file checksum
2589data, plus some other information and magic word, are appended to the
2590compressed file.  This allows the cache update to be done in-place.
2591
2592=head2 File name mangling
2593
2594Backup file names are stored in "mangled" form. Each node of
2595a path is preceded by "f" (mnemonic: file), and special characters
2596(\n, \r, % and /) are URI-encoded as "%xx", where xx is the ascii
2597character's hex value.  So c:/craig/example.txt is now stored as
2598fc/fcraig/fexample.txt.
2599
2600This was done mainly so meta-data could be stored alongside the backup
2601files without name collisions. In particular, the attributes for the
2602files in a directory are stored in a file called "attrib", and mangling
2603avoids file name collisions (I discarded the idea of having a duplicate
2604directory tree for every backup just to store the attributes). Other
2605meta-data (eg: rsync checksums) could be stored in file names preceded
2606by, eg, "c". There are two other benefits to mangling: the share name
2607might contain "/" (eg: "/home/craig" for tar transport), and I wanted
2608that represented as a single level in the storage tree. Secondly, as
2609files are written to NewFileList for later processing by BackupPC_link,
2610embedded newlines in the file's path will cause problems which are
2611avoided by mangling.
2612
2613The CGI script undoes the mangling, so it is invisible to the user.
2614Old (unmangled) backups are still supported by the CGI
2615interface.
2616
2617=head2 Special files
2618
2619Linux/unix file systems support several special file types: symbolic
2620links, character and block device files, fifos (pipes) and unix-domain
2621sockets. All except unix-domain sockets are supported by BackupPC
2622(there's no point in backing up or restoring unix-domain sockets since
2623they only have meaning after a process creates them). Symbolic links are
2624stored as a plain file whose contents are the contents of the link (not
2625the file it points to). This file is compressed and pooled like any
2626normal file. Character and block device files are also stored as plain
2627files, whose contents are two integers separated by a comma; the numbers
2628are the major and minor device number. These files are compressed and
2629pooled like any normal file. Fifo files are stored as empty plain files
2630(which are not pooled since they have zero size). In all cases, the
2631original file type is stored in the attrib file so it can be correctly
2632restored.
2633
2634Hardlinks are also supported.  When GNU tar first encounters a file with
2635more than one link (ie: hardlinks) it dumps it as a regular file.  When
2636it sees the second and subsequent hardlinks to the same file, it dumps
2637just the hardlink information.  BackupPC correctly recognizes these
2638hardlinks and stores them just like symlinks: a regular text file
2639whose contents is the path of the file linked to.  The CGI script
2640will download the original file when you click on a hardlink.
2641
2642Also, BackupPC_tarCreate has enough magic to re-create the hardlinks
2643dynamically based on whether or not the original file and hardlinks
2644are both included in the tar file.  For example, imagine a/b/x is a
2645hardlink to a/c/y.  If you use BackupPC_tarCreate to restore directory
2646a, then the tar file will include a/b/x as the original file and a/c/y
2647will be a hardlink to a/b/x.  If, instead you restore a/c, then the
2648tar file will include a/c/y as the original file, not a hardlink.
2649
2650=head2 Attribute file format
2651
2652The unix attributes for the contents of a directory (all the files and
2653directories in that directory) are stored in a file called attrib.
2654There is a single attrib file for each directory in a backup.
2655For example, if c:/craig contains a single file c:/craig/example.txt,
2656that file would be stored as fc/fcraig/fexample.txt and there would be an
2657attribute file in fc/fcraig/attrib (and also fc/attrib and ./attrib).
2658The file fc/fcraig/attrib would contain a single entry containing the
2659attributes for fc/fcraig/fexample.txt.
2660
2661The attrib file starts with a magic number, followed by the
2662concatenation of the following information for each file:
2663
2664=over 4
2665
2666=item *
2667
2668File name length in perl's pack "w" format (variable length base 128).
2669
2670=item *
2671
2672File name.
2673
2674=item *
2675
2676The unix file type, mode, uid, gid and file size divided by 4GB and
2677file size modulo 4GB (type mode uid gid sizeDiv4GB sizeMod4GB),
2678in perl's pack "w" format (variable length base 128).
2679
2680=item *
2681
2682The unix mtime (unix seconds) in perl's pack "N" format (32 bit integer).
2683
2684=back
2685
2686The attrib file is also compressed if compression is enabled.
2687See the lib/BackupPC/Attrib.pm module for full details.
2688
2689Attribute files are pooled just like normal backup files.  This saves
2690space if all the files in a directory have the same attributes across
2691multiple backups, which is common.
2692
2693=head2 Optimizations
2694
2695BackupPC doesn't care about the access time of files in the pool
2696since it saves attribute meta-data separate from the files.  Since
2697BackupPC mostly does reads from disk, maintaining the access time of
2698files generates a lot of unnecessary disk writes.  So, provided
2699BackupPC has a dedicated data disk, you should consider mounting
2700BackupPC's data directory with the noatime (or, with Linux
2701kernels >=2.6.20, relatime) attribute (see mount(1)).
2702
2703=head2 Some Limitations
2704
2705BackupPC isn't perfect (but it is getting better). Please see
2706L<http://backuppc.sourceforge.net/faq/limitations.html> for a
2707discussion of some of BackupPC's limitations.
2708
2709=head2 Security issues
2710
2711Please see L<http://backuppc.sourceforge.net/faq/security.html> for a
2712discussion of some of various security issues.
2713
2714=head1 Configuration File
2715
2716The BackupPC configuration file resides in __CONFDIR__/config.pl.
2717Optional per-PC configuration files reside in __CONFDIR__/pc/$host.pl
2718(or __TOPDIR__/pc/$host/config.pl in non-FHS versions of BackupPC).
2719This file can be used to override settings just for a particular PC.
2720
2721=head2 Modifying the main configuration file
2722
2723The configuration file is a perl script that is executed by BackupPC, so
2724you should be careful to preserve the file syntax (punctuation, quotes
2725etc) when you edit it. It is recommended that you use CVS, RCS or some
2726other method of source control for changing config.pl.
2727
2728BackupPC reads or re-reads the main configuration file and
2729the hosts file in three cases:
2730
2731=over 4
2732
2733=item *
2734
2735Upon startup.
2736
2737=item *
2738
2739When BackupPC is sent a HUP (-1) signal.  Assuming you installed the
2740init.d script, you can also do this with "/etc/init.d/backuppc reload".
2741
2742=item *
2743
2744When the modification time of config.pl file changes.  BackupPC
2745checks the modification time once during each regular wakeup.
2746
2747=back
2748
2749Whenever you change the configuration file you can either do
2750a kill -HUP BackupPC_pid or simply wait until the next regular
2751wakeup period.
2752
2753Each time the configuration file is re-read a message is reported in the
2754LOG file, so you can tail it (or view it via the CGI interface) to make
2755sure your kill -HUP worked. Errors in parsing the configuration file are
2756also reported in the LOG file.
2757
2758The optional per-PC configuration file (__CONFDIR__/pc/$host.pl or
2759__TOPDIR__/pc/$host/config.pl in non-FHS versions of BackupPC)
2760is read whenever it is needed by BackupPC_dump, BackupPC_link and others.
2761
2762=head1 Configuration Parameters
2763
2764The configuration parameters are divided into five general groups.
2765The first group (general server configuration) provides general
2766configuration for BackupPC.  The next two groups describe what to
2767backup, when to do it, and how long to keep it.  The fourth group
2768are settings for email reminders, and the final group contains
2769settings for the CGI interface.
2770
2771All configuration settings in the second through fifth groups can
2772be overridden by the per-PC config.pl file.
2773
2774=head2 General server configuration
2775
2776=over 4
2777
2778=item $Conf{ServerHost} = '';
2779
2780Host name on which the BackupPC server is running.
2781
2782=item $Conf{ServerPort} = -1;
2783
2784TCP port number on which the BackupPC server listens for and accepts
2785connections.  Normally this should be disabled (set to -1).  The TCP
2786port is only needed if apache runs on a different machine from BackupPC.
2787In that case, set this to any spare port number over 1024 (eg: 2359).
2788If you enable the TCP port, make sure you set $Conf{ServerMesgSecret}
2789too!
2790
2791=item $Conf{ServerMesgSecret} = '';
2792
2793Shared secret to make the TCP port secure.  Set this to a hard to guess
2794string if you enable the TCP port (ie: $Conf{ServerPort} > 0).
2795
2796To avoid possible attacks via the TCP socket interface, every client
2797message is protected by an MD5 digest. The MD5 digest includes four
2798items:
2799  - a seed that is sent to the client when the connection opens
2800  - a sequence number that increments for each message
2801  - a shared secret that is stored in $Conf{ServerMesgSecret}
2802  - the message itself.
2803
2804The message is sent in plain text preceded by the MD5 digest.  A
2805snooper can see the plain-text seed sent by BackupPC and plain-text
2806message from the client, but cannot construct a valid MD5 digest since
2807the secret $Conf{ServerMesgSecret} is unknown.  A replay attack is
2808not possible since the seed changes on a per-connection and
2809per-message basis.
2810
2811=item $Conf{MyPath} = '/bin';
2812
2813PATH setting for BackupPC.  An explicit value is necessary
2814for taint mode.  Value shouldn't matter too much since
2815all execs use explicit paths.  However, taint mode in perl
2816will complain if this directory is world writable.
2817
2818=item $Conf{UmaskMode} = 027;
2819
2820Permission mask for directories and files created by BackupPC.
2821Default value prevents any access from group other, and prevents
2822group write.
2823
2824=item $Conf{WakeupSchedule} = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
2825
2826Times at which we wake up, check all the PCs, and schedule necessary
2827backups.  Times are measured in hours since midnight.  Can be
2828fractional if necessary (eg: 4.25 means 4:15am).
2829
2830If the hosts you are backing up are always connected to the network
2831you might have only one or two wakeups each night.  This will keep
2832the backup activity after hours.  On the other hand, if you are backing
2833up laptops that are only intermittently connected to the network you
2834will want to have frequent wakeups (eg: hourly) to maximize the chance
2835that each laptop is backed up.
2836
2837Examples:
2838
2839    $Conf{WakeupSchedule} = [22.5];         # once per day at 10:30 pm.
2840    $Conf{WakeupSchedule} = [2,4,6,8,10,12,14,16,18,20,22];  # every 2 hours
2841
2842The default value is every hour except midnight.
2843
2844The first entry of $Conf{WakeupSchedule} is when BackupPC_nightly is run.
2845You might want to re-arrange the entries in $Conf{WakeupSchedule}
2846(they don't have to be ascending) so that the first entry is when
2847you want BackupPC_nightly to run (eg: when you don't expect a lot
2848of regular backups to run).
2849
2850=item $Conf{MaxBackups} = 4;
2851
2852Maximum number of simultaneous backups to run.  If there
2853are no user backup requests then this is the maximum number
2854of simultaneous backups.
2855
2856=item $Conf{MaxUserBackups} = 4;
2857
2858Additional number of simultaneous backups that users can run.
2859As many as $Conf{MaxBackups} + $Conf{MaxUserBackups} requests can
2860run at the same time.
2861
2862=item $Conf{MaxPendingCmds} = 15;
2863
2864Maximum number of pending link commands. New backups will only be
2865started if there are no more than $Conf{MaxPendingCmds} plus
2866$Conf{MaxBackups} number of pending link commands, plus running jobs.
2867This limit is to make sure BackupPC doesn't fall too far behind in
2868running BackupPC_link commands.
2869
2870=item $Conf{CmdQueueNice} = 10;
2871
2872Nice level at which CmdQueue commands (eg: BackupPC_link and
2873BackupPC_nightly) are run at.
2874
2875=item $Conf{MaxBackupPCNightlyJobs} = 2;
2876
2877How many BackupPC_nightly processes to run in parallel.
2878
2879Each night, at the first wakeup listed in $Conf{WakeupSchedule},
2880BackupPC_nightly is run.  Its job is to remove unneeded files
2881in the pool, ie: files that only have one link.  To avoid race
2882conditions, BackupPC_nightly and BackupPC_link cannot run at
2883the same time.  Starting in v3.0.0, BackupPC_nightly can run
2884concurrently with backups (BackupPC_dump).
2885
2886So to reduce the elapsed time, you might want to increase this
2887setting to run several BackupPC_nightly processes in parallel
2888(eg: 4, or even 8).
2889
2890=item $Conf{BackupPCNightlyPeriod} = 1;
2891
2892How many days (runs) it takes BackupPC_nightly to traverse the
2893entire pool.  Normally this is 1, which means every night it runs,
2894it does traverse the entire pool removing unused pool files.
2895
2896Other valid values are 2, 4, 8, 16.  This causes BackupPC_nightly to
2897traverse 1/2, 1/4, 1/8 or 1/16th of the pool each night, meaning it
2898takes 2, 4, 8 or 16 days to completely traverse the pool.  The
2899advantage is that each night the running time of BackupPC_nightly
2900is reduced roughly in proportion, since the total job is split
2901over multiple days.  The disadvantage is that unused pool files
2902take longer to get deleted, which will slightly increase disk
2903usage.
2904
2905Note that even when $Conf{BackupPCNightlyPeriod} > 1, BackupPC_nightly
2906still runs every night.  It just does less work each time it runs.
2907
2908Examples:
2909
2910
2911   $Conf{BackupPCNightlyPeriod} = 1;   # entire pool is checked every night
2912
2913   $Conf{BackupPCNightlyPeriod} = 2;   # two days to complete pool check
2914                                       # (different half each night)
2915
2916   $Conf{BackupPCNightlyPeriod} = 4;   # four days to complete pool check
2917                                       # (different quarter each night)
2918
2919=item $Conf{MaxOldLogFiles} = 14;
2920
2921Maximum number of log files we keep around in log directory.
2922These files are aged nightly.  A setting of 14 means the log
2923directory will contain about 2 weeks of old log files, in
2924particular at most the files LOG, LOG.0, LOG.1, ... LOG.13
2925(except today's LOG, these files will have a .z extension if
2926compression is on).
2927
2928If you decrease this number after BackupPC has been running for a
2929while you will have to manually remove the older log files.
2930
2931=item $Conf{DfPath} = '';
2932
2933Full path to the df command.  Security caution: normal users
2934should not allowed to write to this file or directory.
2935
2936=item $Conf{DfCmd} = '$dfPath $topDir';
2937
2938Command to run df.  The following variables are substituted at run-time:
2939
2940  $dfPath      path to df ($Conf{DfPath})
2941  $topDir      top-level BackupPC data directory
2942
2943Note: all Cmds are executed directly without a shell, so the prog name
2944needs to be a full path and you can't include shell syntax like
2945redirection and pipes; put that in a script if you need it.
2946
2947=item $Conf{SplitPath} = '';
2948
2949=item $Conf{ParPath} = '';
2950
2951=item $Conf{CatPath} = '';
2952
2953=item $Conf{GzipPath} = '';
2954
2955=item $Conf{Bzip2Path} = '';
2956
2957Full path to various commands for archiving
2958
2959=item $Conf{DfMaxUsagePct} = 95;
2960
2961Maximum threshold for disk utilization on the __TOPDIR__ filesystem.
2962If the output from $Conf{DfPath} reports a percentage larger than
2963this number then no new regularly scheduled backups will be run.
2964However, user requested backups (which are usually incremental and
2965tend to be small) are still performed, independent of disk usage.
2966Also, currently running backups will not be terminated when the disk
2967usage exceeds this number.
2968
2969=item $Conf{TrashCleanSleepSec} = 300;
2970
2971How long BackupPC_trashClean sleeps in seconds between each check
2972of the trash directory.  Once every 5 minutes should be reasonable.
2973
2974=item $Conf{DHCPAddressRanges} = [];
2975
2976List of DHCP address ranges we search looking for PCs to backup.
2977This is an array of hashes for each class C address range.
2978This is only needed if hosts in the conf/hosts file have the
2979dhcp flag set.
2980
2981Examples:
2982
2983   # to specify 192.10.10.20 to 192.10.10.250 as the DHCP address pool
2984   $Conf{DHCPAddressRanges} = [
2985       {
2986           ipAddrBase => '192.10.10',
2987           first => 20,
2988           last  => 250,
2989       },
2990   ];
2991   # to specify two pools (192.10.10.20-250 and 192.10.11.10-50)
2992   $Conf{DHCPAddressRanges} = [
2993       {
2994           ipAddrBase => '192.10.10',
2995           first => 20,
2996           last  => 250,
2997       },
2998       {
2999           ipAddrBase => '192.10.11',
3000           first => 10,
3001           last  => 50,
3002       },
3003   ];
3004
3005=item $Conf{BackupPCUser} = '';
3006
3007The BackupPC user.
3008
3009=item $Conf{TopDir} = '';
3010
3011=item $Conf{ConfDir} = '';
3012
3013=item $Conf{LogDir} = '';
3014
3015=item $Conf{InstallDir} = '';
3016
3017=item $Conf{CgiDir} = '';
3018
3019Important installation directories:
3020
3021  TopDir     - where all the backup data is stored
3022  ConfDir    - where the main config and hosts files resides
3023  LogDir     - where log files and other transient information
3024  InstallDir - where the bin, lib and doc installation dirs reside.
3025               Note: you cannot change this value since all the
3026               perl scripts include this path.  You must reinstall
3027               with configure.pl to change InstallDir.
3028  CgiDir     - Apache CGI directory for BackupPC_Admin
3029
3030Note: it is STRONGLY recommended that you don't change the
3031values here.  These are set at installation time and are here
3032for reference and are used during upgrades.
3033
3034Instead of changing TopDir here it is recommended that you use
3035a symbolic link to the new location, or mount the new BackupPC
3036store at the existing $Conf{TopDir} setting.
3037
3038=item $Conf{BackupPCUserVerify} = 1;
3039
3040Whether BackupPC and the CGI script BackupPC_Admin verify that they
3041are really running as user $Conf{BackupPCUser}.  If this flag is set
3042and the effective user id (euid) differs from $Conf{BackupPCUser}
3043then both scripts exit with an error.  This catches cases where
3044BackupPC might be accidently started as root or the wrong user,
3045or if the CGI script is not installed correctly.
3046
3047=item $Conf{HardLinkMax} = 31999;
3048
3049Maximum number of hardlinks supported by the $TopDir file system
3050that BackupPC uses.  Most linux or unix file systems should support
3051at least 32000 hardlinks per file, or 64000 in other cases.  If a pool
3052file already has this number of hardlinks, a new pool file is created
3053so that new hardlinks can be accommodated.  This limit will only
3054be hit if an identical file appears at least this number of times
3055across all the backups.
3056
3057=item $Conf{PerlModuleLoad} = undef;
3058
3059Advanced option for asking BackupPC to load additional perl modules.
3060Can be a list (array ref) of module names to load at startup.
3061
3062=item $Conf{ServerInitdPath} = '';
3063
3064=item $Conf{ServerInitdStartCmd} = '';
3065
3066Path to init.d script and command to use that script to start the
3067server from the CGI interface.  The following variables are substituted
3068at run-time:
3069
3070  $sshPath           path to ssh ($Conf{SshPath})
3071  $serverHost        same as $Conf{ServerHost}
3072  $serverInitdPath   path to init.d script ($Conf{ServerInitdPath})
3073
3074Example:
3075
3076
3077$Conf{ServerInitdPath}     = '/etc/init.d/backuppc';
3078$Conf{ServerInitdStartCmd} = '$sshPath -q -x -l root $serverHost'
3079                           . ' $serverInitdPath start'
3080                           . ' < /dev/null >& /dev/null';
3081
3082Note: all Cmds are executed directly without a shell, so the prog name
3083needs to be a full path and you can't include shell syntax like
3084redirection and pipes; put that in a script if you need it.
3085
3086=back
3087
3088=head2 What to backup and when to do it
3089
3090=over 4
3091
3092=item $Conf{FullPeriod} = 6.97;
3093
3094Minimum period in days between full backups. A full dump will only be
3095done if at least this much time has elapsed since the last full dump,
3096and at least $Conf{IncrPeriod} days has elapsed since the last
3097successful dump.
3098
3099Typically this is set slightly less than an integer number of days. The
3100time taken for the backup, plus the granularity of $Conf{WakeupSchedule}
3101will make the actual backup interval a bit longer.
3102
3103=item $Conf{IncrPeriod} = 0.97;
3104
3105Minimum period in days between incremental backups (a user requested
3106incremental backup will be done anytime on demand).
3107
3108Typically this is set slightly less than an integer number of days. The
3109time taken for the backup, plus the granularity of $Conf{WakeupSchedule}
3110will make the actual backup interval a bit longer.
3111
3112=item $Conf{FullKeepCnt} = 1;
3113
3114Number of full backups to keep.  Must be >= 1.
3115
3116In the steady state, each time a full backup completes successfully
3117the oldest one is removed.  If this number is decreased, the
3118extra old backups will be removed.
3119
3120If filling of incremental dumps is off the oldest backup always
3121has to be a full (ie: filled) dump.  This might mean one or two
3122extra full dumps are kept until the oldest incremental backups expire.
3123
3124Exponential backup expiry is also supported.  This allows you to specify:
3125
3126  - num fulls to keep at intervals of 1 * $Conf{FullPeriod}, followed by
3127  - num fulls to keep at intervals of 2 * $Conf{FullPeriod},
3128  - num fulls to keep at intervals of 4 * $Conf{FullPeriod},
3129  - num fulls to keep at intervals of 8 * $Conf{FullPeriod},
3130  - num fulls to keep at intervals of 16 * $Conf{FullPeriod},
3131
3132and so on.  This works by deleting every other full as each expiry
3133boundary is crossed.
3134
3135Exponential expiry is specified using an array for $Conf{FullKeepCnt}:
3136
3137  $Conf{FullKeepCnt} = [4, 2, 3];
3138
3139Entry #n specifies how many fulls to keep at an interval of
31402^n * $Conf{FullPeriod} (ie: 1, 2, 4, 8, 16, 32, ...).
3141
3142The example above specifies keeping 4 of the most recent full backups
3143(1 week interval) two full backups at 2 week intervals, and 3 full
3144backups at 4 week intervals, eg:
3145
3146   full 0 19 weeks old   \
3147   full 1 15 weeks old    >---  3 backups at 4 * $Conf{FullPeriod}
3148   full 2 11 weeks old   /
3149   full 3  7 weeks old   \____  2 backups at 2 * $Conf{FullPeriod}
3150   full 4  5 weeks old   /
3151   full 5  3 weeks old   \
3152   full 6  2 weeks old    \___  4 backups at 1 * $Conf{FullPeriod}
3153   full 7  1 week old     /
3154   full 8  current       /
3155
3156On a given week the spacing might be less than shown as each backup
3157ages through each expiry period.  For example, one week later, a
3158new full is completed and the oldest is deleted, giving:
3159
3160   full 0 16 weeks old   \
3161   full 1 12 weeks old    >---  3 backups at 4 * $Conf{FullPeriod}
3162   full 2  8 weeks old   /
3163   full 3  6 weeks old   \____  2 backups at 2 * $Conf{FullPeriod}
3164   full 4  4 weeks old   /
3165   full 5  3 weeks old   \
3166   full 6  2 weeks old    \___  4 backups at 1 * $Conf{FullPeriod}
3167   full 7  1 week old     /
3168   full 8  current       /
3169
3170You can specify 0 as a count (except in the first entry), and the
3171array can be as long as you wish.  For example:
3172
3173
3174  $Conf{FullKeepCnt} = [4, 0, 4, 0, 0, 2];
3175
3176This will keep 10 full dumps, 4 most recent at 1 * $Conf{FullPeriod},
3177followed by 4 at an interval of 4 * $Conf{FullPeriod} (approx 1 month
3178apart), and then 2 at an interval of 32 * $Conf{FullPeriod} (approx
31797-8 months apart).
3180
3181Example: these two settings are equivalent and both keep just
3182the four most recent full dumps:
3183
3184   $Conf{FullKeepCnt} = 4;
3185   $Conf{FullKeepCnt} = [4];
3186
3187=item $Conf{FullKeepCntMin} = 1;
3188
3189=item $Conf{FullAgeMax} = 90;
3190
3191Very old full backups are removed after $Conf{FullAgeMax} days.  However,
3192we keep at least $Conf{FullKeepCntMin} full backups no matter how old
3193they are.
3194
3195Note that $Conf{FullAgeMax} will be increased to $Conf{FullKeepCnt}
3196times $Conf{FullPeriod} if $Conf{FullKeepCnt} specifies enough
3197full backups to exceed $Conf{FullAgeMax}.
3198
3199=item $Conf{IncrKeepCnt} = 6;
3200
3201Number of incremental backups to keep.  Must be >= 1.
3202
3203In the steady state, each time an incr backup completes successfully
3204the oldest one is removed.  If this number is decreased, the
3205extra old backups will be removed.
3206
3207=item $Conf{IncrKeepCntMin} = 1;
3208
3209=item $Conf{IncrAgeMax} = 30;
3210
3211Very old incremental backups are removed after $Conf{IncrAgeMax} days.
3212However, we keep at least $Conf{IncrKeepCntMin} incremental backups no
3213matter how old they are.
3214
3215=item $Conf{IncrLevels} = [1];
3216
3217Level of each incremental.  "Level" follows the terminology
3218of dump(1).  A full backup has level 0.  A new incremental
3219of level N will backup all files that have changed since
3220the most recent backup of a lower level.
3221
3222The entries of $Conf{IncrLevels} apply in order to each
3223incremental after each full backup.  It wraps around until
3224the next full backup.  For example, these two settings
3225have the same effect:
3226
3227      $Conf{IncrLevels} = [1, 2, 3];
3228      $Conf{IncrLevels} = [1, 2, 3, 1, 2, 3];
3229
3230This means the 1st and 4th incrementals (level 1) go all
3231the way back to the full.  The 2nd and 3rd (and 5th and
32326th) backups just go back to the immediate preceeding
3233incremental.
3234
3235Specifying a sequence of multi-level incrementals will
3236usually mean more than $Conf{IncrKeepCnt} incrementals will
3237need to be kept, since lower level incrementals are needed
3238to merge a complete view of a backup.  For example, with
3239
3240      $Conf{FullPeriod}  = 7;
3241      $Conf{IncrPeriod}  = 1;
3242      $Conf{IncrKeepCnt} = 6;
3243      $Conf{IncrLevels}  = [1, 2, 3, 4, 5, 6];
3244
3245there will be up to 11 incrementals in this case:
3246
3247      backup #0  (full, level 0, oldest)
3248      backup #1  (incr, level 1)
3249      backup #2  (incr, level 2)
3250      backup #3  (incr, level 3)
3251      backup #4  (incr, level 4)
3252      backup #5  (incr, level 5)
3253      backup #6  (incr, level 6)
3254      backup #7  (full, level 0)
3255      backup #8  (incr, level 1)
3256      backup #9  (incr, level 2)
3257      backup #10 (incr, level 3)
3258      backup #11 (incr, level 4)
3259      backup #12 (incr, level 5, newest)
3260
3261Backup #1 (the oldest level 1 incremental) can't be deleted
3262since backups 2..6 depend on it.  Those 6 incrementals can't
3263all be deleted since that would only leave 5 (#8..12).
3264When the next incremental happens (level 6), the complete
3265set of 6 older incrementals (#1..6) will be deleted, since
3266that maintains the required number ($Conf{IncrKeepCnt})
3267of incrementals.  This situation is reduced if you set
3268shorter chains of multi-level incrementals, eg:
3269
3270      $Conf{IncrLevels}  = [1, 2, 3];
3271
3272would only have up to 2 extra incremenals before all 3
3273are deleted.
3274
3275BackupPC as usual merges the full and the sequence
3276of incrementals together so each incremental can be
3277browsed and restored as though it is a complete backup.
3278If you specify a long chain of incrementals then more
3279backups need to be merged when browsing, restoring,
3280or getting the starting point for rsync backups.
3281In the example above (levels 1..6), browing backup
3282#6 requires 7 different backups (#0..6) to be merged.
3283
3284Because of this merging and the additional incrementals
3285that need to be kept, it is recommended that some
3286level 1 incrementals be included in $Conf{IncrLevels}.
3287
3288Prior to version 3.0 incrementals were always level 1,
3289meaning each incremental backed up all the files that
3290changed since the last full.
3291
3292=item $Conf{BackupsDisable} = 0;
3293
3294Disable all full and incremental backups.  These settings are
3295useful for a client that is no longer being backed up
3296(eg: a retired machine), but you wish to keep the last
3297backups available for browsing or restoring to other machines.
3298
3299There are three values for $Conf{BackupsDisable}:
3300
3301  0    Backups are enabled.
3302
3303  1    Don't do any regular backups on this client.  Manually
3304       requested backups (via the CGI interface) will still occur.
3305
3306  2    Don't do any backups on this client.  Manually requested
3307       backups (via the CGI interface) will be ignored.
3308
3309In versions prior to 3.0 Backups were disabled by setting
3310$Conf{FullPeriod} to -1 or -2.
3311
3312=item $Conf{PartialAgeMax} = 3;
3313
3314A failed full backup is saved as a partial backup.  The rsync
3315XferMethod can take advantage of the partial full when the next
3316backup is run. This parameter sets the age of the partial full
3317in days: if the partial backup is older than this number of
3318days, then rsync will ignore (not use) the partial full when
3319the next backup is run.  If you set this to a negative value
3320then no partials will be saved.  If you set this to 0, partials
3321will be saved, but will not be used by the next backup.
3322
3323The default setting of 3 days means that a partial older than
33243 days is ignored when the next full backup is done.
3325
3326=item $Conf{IncrFill} = 0;
3327
3328Whether incremental backups are filled.  "Filling" means that the
3329most recent full (or filled) dump is merged into the new incremental
3330dump using hardlinks.  This makes an incremental dump look like a
3331full dump.  Prior to v1.03 all incremental backups were filled.
3332In v1.4.0 and later the default is off.
3333
3334BackupPC, and the cgi interface in particular, do the right thing on
3335un-filled incremental backups.  It will correctly display the merged
3336incremental backup with the most recent filled backup, giving the
3337un-filled incremental backups a filled appearance.  That means it
3338invisible to the user whether incremental dumps are filled or not.
3339
3340Filling backups takes a little extra disk space, and it does cost
3341some extra disk activity for filling, and later removal.  Filling
3342is no longer useful, since file mangling and compression doesn't
3343make a filled backup very useful. It's likely the filling option
3344will be removed from future versions: filling will be delegated to
3345the display and extraction of backup data.
3346
3347If filling is off, BackupPC makes sure that the oldest backup is
3348a full, otherwise the following incremental backups will be
3349incomplete.  This might mean an extra full backup has to be
3350kept until the following incremental backups expire.
3351
3352The default is off.  You can turn this on or off at any
3353time without affecting existing backups.
3354
3355=item $Conf{RestoreInfoKeepCnt} = 10;
3356
3357Number of restore logs to keep.  BackupPC remembers information about
3358each restore request.  This number per client will be kept around before
3359the oldest ones are pruned.
3360
3361Note: files/dirs delivered via Zip or Tar downloads don't count as
3362restores.  Only the first restore option (where the files and dirs
3363are written to the host) count as restores that are logged.
3364
3365=item $Conf{ArchiveInfoKeepCnt} = 10;
3366
3367Number of archive logs to keep.  BackupPC remembers information
3368about each archive request.  This number per archive client will
3369be kept around before the oldest ones are pruned.
3370
3371=item $Conf{BackupFilesOnly} = undef;
3372
3373List of directories or files to backup.  If this is defined, only these
3374directories or files will be backed up.
3375
3376When editing from the web interface, you should add a valid ShareName
3377(based on $Conf{XferMethod}), and then enter the directories specific
3378to that ShareName.  A special ShareName "*" matches any ShareName that
3379doesn't have an explicit entry.
3380
3381For Smb, only one of $Conf{BackupFilesExclude} and $Conf{BackupFilesOnly}
3382can be specified per share. If both are set for a particular share, then
3383$Conf{BackupFilesOnly} takes precedence and $Conf{BackupFilesExclude}
3384is ignored.
3385
3386This can be set to a string, an array of strings, or, in the case
3387of multiple shares, a hash of strings or arrays.  A hash is used
3388to give a list of directories or files to backup for each share
3389(the share name is the key).  If this is set to just a string or
3390array, and $Conf{SmbShareName} contains multiple share names, then
3391the setting is assumed to apply all shares.
3392
3393If a hash is used, a special key "*" means it applies to all
3394shares that don't have a specific entry.
3395
3396Examples:
3397
3398   $Conf{BackupFilesOnly} = '/myFiles';
3399   $Conf{BackupFilesOnly} = ['/myFiles'];     # same as first example
3400   $Conf{BackupFilesOnly} = ['/myFiles', '/important'];
3401   $Conf{BackupFilesOnly} = {
3402      'c' => ['/myFiles', '/important'],      # these are for 'c' share
3403      'd' => ['/moreFiles', '/archive'],      # these are for 'd' share
3404   };
3405   $Conf{BackupFilesOnly} = {
3406      'c' => ['/myFiles', '/important'],      # these are for 'c' share
3407      '*' => ['/myFiles', '/important'],      # these are other shares
3408   };
3409
3410=item $Conf{BackupFilesExclude} = undef;
3411
3412List of directories or files to exclude from the backup.  For Smb,
3413only one of $Conf{BackupFilesExclude} and $Conf{BackupFilesOnly}
3414can be specified per share.  If both are set for a particular share,
3415then $Conf{BackupFilesOnly} takes precedence and
3416$Conf{BackupFilesExclude} is ignored.
3417
3418When editing from the web interface, you should add a valid ShareName
3419(based on $Conf{XferMethod}), and then enter the directories or files
3420specific to that ShareName.  A special ShareName "*" matches any
3421ShareName that doesn't have an explicit entry.
3422
3423This can be set to a string, an array of strings, or, in the case
3424of multiple shares, a hash of strings or arrays.  A hash is used
3425to give a list of directories or files to exclude for each share
3426(the share name is the key).  If this is set to just a string or
3427array, and $Conf{SmbShareName} contains multiple share names, then
3428the setting is assumed to apply to all shares.
3429
3430The exact behavior is determined by the underlying transport program,
3431smbclient or tar.  For smbclient the exlclude file list is passed into
3432the X option.  Simple shell wild-cards using "*" or "?" are allowed.
3433
3434For tar, if the exclude file contains a "/" it is assumed to be anchored
3435at the start of the string.  Since all the tar paths start with "./",
3436BackupPC prepends a "." if the exclude file starts with a "/".  Note
3437that GNU tar version >= 1.13.7 is required for the exclude option to
3438work correctly.  For linux or unix machines you should add
3439"/proc" to $Conf{BackupFilesExclude} unless you have specified
3440--one-file-system in $Conf{TarClientCmd} or --one-file-system in
3441$Conf{RsyncArgs}.  Also, for tar, do not use a trailing "/" in
3442the directory name: a trailing "/" causes the name to not match
3443and the directory will not be excluded.
3444
3445Users report that for smbclient you should specify a directory
3446followed by "/*", eg: "/proc/*", instead of just "/proc".
3447
3448FTP servers are traversed recursively so excluding directories will
3449also exclude its contents.  You can use the wildcard characters "*"
3450and "?" to define files for inclusion and exclusion.  Both
3451attributes $Conf{BackupFilesOnly} and $Conf{BackupFilesExclude} can
3452be defined for the same share.
3453
3454If a hash is used, a special key "*" means it applies to all
3455shares that don't have a specific entry.
3456
3457Examples:
3458
3459   $Conf{BackupFilesExclude} = '/temp';
3460   $Conf{BackupFilesExclude} = ['/temp'];     # same as first example
3461   $Conf{BackupFilesExclude} = ['/temp', '/winnt/tmp'];
3462   $Conf{BackupFilesExclude} = {
3463      'c' => ['/temp', '/winnt/tmp'],         # these are for 'c' share
3464      'd' => ['/junk', '/dont_back_this_up'], # these are for 'd' share
3465   };
3466   $Conf{BackupFilesExclude} = {
3467      'c' => ['/temp', '/winnt/tmp'],         # these are for 'c' share
3468      '*' => ['/junk', '/dont_back_this_up'], # these are for other shares
3469   };
3470
3471=item $Conf{BlackoutBadPingLimit} = 3;
3472
3473=item $Conf{BlackoutGoodCnt} = 7;
3474
3475PCs that are always or often on the network can be backed up after
3476hours, to reduce PC, network and server load during working hours. For
3477each PC a count of consecutive good pings is maintained. Once a PC has
3478at least $Conf{BlackoutGoodCnt} consecutive good pings it is subject
3479to "blackout" and not backed up during hours and days specified by
3480$Conf{BlackoutPeriods}.
3481
3482To allow for periodic rebooting of a PC or other brief periods when a
3483PC is not on the network, a number of consecutive bad pings is allowed
3484before the good ping count is reset. This parameter is
3485$Conf{BlackoutBadPingLimit}.
3486
3487Note that bad and good pings don't occur with the same interval. If a
3488machine is always on the network, it will only be pinged roughly once
3489every $Conf{IncrPeriod} (eg: once per day). So a setting for
3490$Conf{BlackoutGoodCnt} of 7 means it will take around 7 days for a
3491machine to be subject to blackout. On the other hand, if a ping is
3492failed, it will be retried roughly every time BackupPC wakes up, eg,
3493every one or two hours. So a setting for $Conf{BlackoutBadPingLimit} of
34943 means that the PC will lose its blackout status after 3-6 hours of
3495unavailability.
3496
3497To disable the blackout feature set $Conf{BlackoutGoodCnt} to a negative
3498value.  A value of 0 will make all machines subject to blackout.  But
3499if you don't want to do any backups during the day it would be easier
3500to just set $Conf{WakeupSchedule} to a restricted schedule.
3501
3502=item $Conf{BlackoutPeriods} = [ ... ];
3503
3504One or more blackout periods can be specified.  If a client is
3505subject to blackout then no regular (non-manual) backups will
3506be started during any of these periods.  hourBegin and hourEnd
3507specify hours fro midnight and weekDays is a list of days of
3508the week where 0 is Sunday, 1 is Monday etc.
3509
3510For example:
3511
3512
3513   $Conf{BlackoutPeriods} = [
3514	{
3515	    hourBegin =>  7.0,
3516	    hourEnd   => 19.5,
3517	    weekDays  => [1, 2, 3, 4, 5],
3518	},
3519   ];
3520
3521specifies one blackout period from 7:00am to 7:30pm local time
3522on Mon-Fri.
3523
3524The blackout period can also span midnight by setting
3525hourBegin > hourEnd, eg:
3526
3527   $Conf{BlackoutPeriods} = [
3528	{
3529	    hourBegin =>  7.0,
3530	    hourEnd   => 19.5,
3531	    weekDays  => [1, 2, 3, 4, 5],
3532	},
3533	{
3534	    hourBegin => 23,
3535	    hourEnd   =>  5,
3536	    weekDays  => [5, 6],
3537	},
3538   ];
3539
3540This specifies one blackout period from 7:00am to 7:30pm local time
3541on Mon-Fri, and a second period from 11pm to 5am on Friday and
3542Saturday night.
3543
3544=item $Conf{BackupZeroFilesIsFatal} = 1;
3545
3546A backup of a share that has zero files is considered fatal. This is
3547used to catch miscellaneous Xfer errors that result in no files being
3548backed up.  If you have shares that might be empty (and therefore an
3549empty backup is valid) you should set this flag to 0.
3550
3551=back
3552
3553=head2 How to backup a client
3554
3555=over 4
3556
3557=item $Conf{XferMethod} = 'smb';
3558
3559What transport method to use to backup each host.  If you have
3560a mixed set of WinXX and linux/unix hosts you will need to override
3561this in the per-PC config.pl.
3562
3563The valid values are:
3564
3565  - 'smb':     backup and restore via smbclient and the SMB protocol.
3566               Easiest choice for WinXX.
3567
3568  - 'rsync':   backup and restore via rsync (via rsh or ssh).
3569               Best choice for linux/unix.  Good choice also for WinXX.
3570
3571  - 'rsyncd':  backup and restore via rsync daemon on the client.
3572               Best choice for linux/unix if you have rsyncd running on
3573               the client.  Good choice also for WinXX.
3574
3575  - 'tar':    backup and restore via tar, tar over ssh, rsh or nfs.
3576              Good choice for linux/unix.
3577
3578  - 'archive': host is a special archive host.  Backups are not done.
3579               An archive host is used to archive other host's backups
3580               to permanent media, such as tape, CDR or DVD.
3581
3582
3583=item $Conf{XferLogLevel} = 1;
3584
3585Level of verbosity in Xfer log files.  0 means be quiet, 1 will give
3586will give one line per file, 2 will also show skipped files on
3587incrementals, higher values give more output.
3588
3589=item $Conf{ClientCharset} = '';
3590
3591Filename charset encoding on the client.  BackupPC uses utf8
3592on the server for filename encoding.  If this is empty, then
3593utf8 is assumed and client filenames will not be modified.
3594If set to a different encoding then filenames will converted
3595to/from utf8 automatically during backup and restore.
3596
3597If the file names displayed in the browser (eg: accents or special
3598characters) don't look right then it is likely you haven't set
3599$Conf{ClientCharset} correctly.
3600
3601If you are using smbclient on a WinXX machine, smbclient will convert
3602to the "unix charset" setting in smb.conf.  The default is utf8,
3603in which case leave $Conf{ClientCharset} empty since smbclient does
3604the right conversion.
3605
3606If you are using rsync on a WinXX machine then it does no conversion.
3607A typical WinXX encoding for latin1/western europe is 'cp1252',
3608so in this case set $Conf{ClientCharset} to 'cp1252'.
3609
3610On a linux or unix client, run "locale charmap" to see the client's
3611charset.  Set $Conf{ClientCharset} to this value.  A typical value
3612for english/US is 'ISO-8859-1'.
3613
3614Do "perldoc Encode::Supported" to see the list of possible charset
3615values.  The FAQ at http://www.cl.cam.ac.uk/~mgk25/unicode.html
3616is excellent, and http://czyborra.com/charsets/iso8859.html
3617provides more information on the iso-8859 charsets.
3618
3619=item $Conf{ClientCharsetLegacy} = 'iso-8859-1';
3620
3621Prior to 3.x no charset conversion was done by BackupPC.  Backups were
3622stored in what ever charset the XferMethod provided - typically utf8
3623for smbclient and the client's locale settings for rsync and tar (eg:
3624cp1252 for rsync on WinXX and perhaps iso-8859-1 with rsync on linux).
3625This setting tells BackupPC the charset that was used to store file
3626names in old backups taken with BackupPC 2.x, so that non-ascii file
3627names in old backups can be viewed and restored.
3628
3629=back
3630
3631=head2 Samba Configuration
3632
3633=over 4
3634
3635=item $Conf{SmbShareName} = 'C$';
3636
3637Name of the host share that is backed up when using SMB.  This can be a
3638string or an array of strings if there are multiple shares per host.
3639Examples:
3640
3641
3642  $Conf{SmbShareName} = 'c';          # backup 'c' share
3643  $Conf{SmbShareName} = ['c', 'd'];   # backup 'c' and 'd' shares
3644
3645This setting only matters if $Conf{XferMethod} = 'smb'.
3646
3647=item $Conf{SmbShareUserName} = '';
3648
3649Smbclient share user name.  This is passed to smbclient's -U argument.
3650
3651This setting only matters if $Conf{XferMethod} = 'smb'.
3652
3653=item $Conf{SmbSharePasswd} = '';
3654
3655Smbclient share password.  This is passed to smbclient via its PASSWD
3656environment variable.  There are several ways you can tell BackupPC
3657the smb share password.  In each case you should be very careful about
3658security.  If you put the password here, make sure that this file is
3659not readable by regular users!  See the "Setting up config.pl" section
3660in the documentation for more information.
3661
3662This setting only matters if $Conf{XferMethod} = 'smb'.
3663
3664=item $Conf{SmbClientPath} = '';
3665
3666Full path for smbclient. Security caution: normal users should not
3667allowed to write to this file or directory.
3668
3669smbclient is from the Samba distribution. smbclient is used to
3670actually extract the incremental or full dump of the share filesystem
3671from the PC.
3672
3673This setting only matters if $Conf{XferMethod} = 'smb'.
3674
3675=item $Conf{SmbClientFullCmd} = '$smbClientPath \\\\$host\\$shareName' ...
3676
3677Command to run smbclient for a full dump.
3678This setting only matters if $Conf{XferMethod} = 'smb'.
3679
3680The following variables are substituted at run-time:
3681
3682   $smbClientPath   same as $Conf{SmbClientPath}
3683   $host            host to backup/restore
3684   $hostIP          host IP address
3685   $shareName       share name
3686   $userName        user name
3687   $fileList        list of files to backup (based on exclude/include)
3688   $I_option        optional -I option to smbclient
3689   $X_option        exclude option (if $fileList is an exclude list)
3690   $timeStampFile   start time for incremental dump
3691
3692Note: all Cmds are executed directly without a shell, so the prog name
3693needs to be a full path and you can't include shell syntax like
3694redirection and pipes; put that in a script if you need it.
3695
3696=item $Conf{SmbClientIncrCmd} = '$smbClientPath \\\\$host\\$shareName' ...
3697
3698Command to run smbclient for an incremental dump.
3699This setting only matters if $Conf{XferMethod} = 'smb'.
3700
3701Same variable substitutions are applied as $Conf{SmbClientFullCmd}.
3702
3703Note: all Cmds are executed directly without a shell, so the prog name
3704needs to be a full path and you can't include shell syntax like
3705redirection and pipes; put that in a script if you need it.
3706
3707=item $Conf{SmbClientRestoreCmd} = '$smbClientPath \\\\$host\\$shareName' ...
3708
3709Command to run smbclient for a restore.
3710This setting only matters if $Conf{XferMethod} = 'smb'.
3711
3712Same variable substitutions are applied as $Conf{SmbClientFullCmd}.
3713
3714If your smb share is read-only then direct restores will fail.
3715You should set $Conf{SmbClientRestoreCmd} to undef and the
3716corresponding CGI restore option will be removed.
3717
3718Note: all Cmds are executed directly without a shell, so the prog name
3719needs to be a full path and you can't include shell syntax like
3720redirection and pipes; put that in a script if you need it.
3721
3722=back
3723
3724=head2 Tar Configuration
3725
3726=over 4
3727
3728=item $Conf{TarShareName} = '/';
3729
3730Which host directories to backup when using tar transport.  This can be a
3731string or an array of strings if there are multiple directories to
3732backup per host.  Examples:
3733
3734
3735  $Conf{TarShareName} = '/';			# backup everything
3736  $Conf{TarShareName} = '/home';		# only backup /home
3737  $Conf{TarShareName} = ['/home', '/src'];	# backup /home and /src
3738
3739The fact this parameter is called 'TarShareName' is for historical
3740consistency with the Smb transport options.  You can use any valid
3741directory on the client: there is no need for it to correspond to
3742any Smb share or device mount point.
3743
3744Note also that you can also use $Conf{BackupFilesOnly} to specify
3745a specific list of directories to backup.  It's more efficient to
3746use this option instead of $Conf{TarShareName} since a new tar is
3747run for each entry in $Conf{TarShareName}.
3748
3749On the other hand, if you add --one-file-system to $Conf{TarClientCmd}
3750you can backup each file system separately, which makes restoring one
3751bad file system easier.  In this case you would list all of the mount
3752points here, since you can't get the same result with
3753$Conf{BackupFilesOnly}:
3754
3755    $Conf{TarShareName} = ['/', '/var', '/data', '/boot'];
3756
3757This setting only matters if $Conf{XferMethod} = 'tar'.
3758
3759=item $Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host' ...
3760
3761Command to run tar on the client.  GNU tar is required.  You will
3762need to fill in the correct paths for ssh2 on the local host (server)
3763and GNU tar on the client.  Security caution: normal users should not
3764allowed to write to these executable files or directories.
3765
3766$Conf{TarClientCmd} is appended with with either $Conf{TarFullArgs} or
3767$Conf{TarIncrArgs} to create the final command that is run.
3768
3769See the documentation for more information about setting up ssh2 keys.
3770
3771If you plan to use NFS then tar just runs locally and ssh2 is not needed.
3772For example, assuming the client filesystem is mounted below /mnt/hostName,
3773you could use something like:
3774
3775   $Conf{TarClientCmd} = '$tarPath -c -v -f - -C /mnt/$host/$shareName'
3776                       . ' --totals';
3777
3778In the case of NFS or rsh you need to make sure BackupPC's privileges
3779are sufficient to read all the files you want to backup.  Also, you
3780will probably want to add "/proc" to $Conf{BackupFilesExclude}.
3781
3782The following variables are substituted at run-time:
3783
3784  $host        host name
3785  $hostIP      host's IP address
3786  $incrDate    newer-than date for incremental backups
3787  $shareName   share name to backup (ie: top-level directory path)
3788  $fileList    specific files to backup or exclude
3789  $tarPath     same as $Conf{TarClientPath}
3790  $sshPath     same as $Conf{SshPath}
3791
3792If a variable is followed by a "+" it is shell escaped.  This is
3793necessary for the command part of ssh or rsh, since it ends up
3794getting passed through the shell.
3795
3796This setting only matters if $Conf{XferMethod} = 'tar'.
3797
3798Note: all Cmds are executed directly without a shell, so the prog name
3799needs to be a full path and you can't include shell syntax like
3800redirection and pipes; put that in a script if you need it.
3801
3802=item $Conf{TarFullArgs} = '$fileList+';
3803
3804Extra tar arguments for full backups.  Several variables are substituted at
3805run-time.  See $Conf{TarClientCmd} for the list of variable substitutions.
3806
3807If you are running tar locally (ie: without rsh or ssh) then remove the
3808"+" so that the argument is no longer shell escaped.
3809
3810This setting only matters if $Conf{XferMethod} = 'tar'.
3811
3812=item $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+';
3813
3814Extra tar arguments for incr backups.  Several variables are substituted at
3815run-time.  See $Conf{TarClientCmd} for the list of variable substitutions.
3816
3817Note that GNU tar has several methods for specifying incremental backups,
3818including:
3819
3820  --newer-mtime $incrDate+
3821         This causes a file to be included if the modification time is
3822         later than $incrDate (meaning its contents might have changed).
3823         But changes in the ownership or modes will not qualify the
3824         file to be included in an incremental.
3825
3826  --newer=$incrDate+
3827         This causes the file to be included if any attribute of the
3828         file is later than $incrDate, meaning either attributes or
3829         the modification time.  This is the default method.  Do
3830         not use --atime-preserve in $Conf{TarClientCmd} above,
3831         otherwise resetting the atime (access time) counts as an
3832         attribute change, meaning the file will always be included
3833         in each new incremental dump.
3834
3835If you are running tar locally (ie: without rsh or ssh) then remove the
3836"+" so that the argument is no longer shell escaped.
3837
3838This setting only matters if $Conf{XferMethod} = 'tar'.
3839
3840=item $Conf{TarClientRestoreCmd} = '$sshPath -q -x -l root $host' ...
3841
3842Full command to run tar for restore on the client.  GNU tar is required.
3843This can be the same as $Conf{TarClientCmd}, with tar's -c replaced by -x
3844and ssh's -n removed.
3845
3846See $Conf{TarClientCmd} for full details.
3847
3848This setting only matters if $Conf{XferMethod} = "tar".
3849
3850If you want to disable direct restores using tar, you should set
3851$Conf{TarClientRestoreCmd} to undef and the corresponding CGI
3852restore option will be removed.
3853
3854Note: all Cmds are executed directly without a shell, so the prog name
3855needs to be a full path and you can't include shell syntax like
3856redirection and pipes; put that in a script if you need it.
3857
3858=item $Conf{TarClientPath} = '';
3859
3860Full path for tar on the client. Security caution: normal users should not
3861allowed to write to this file or directory.
3862
3863This setting only matters if $Conf{XferMethod} = 'tar'.
3864
3865=back
3866
3867=head2 Rsync/Rsyncd Configuration
3868
3869=over 4
3870
3871=item $Conf{RsyncClientPath} = '';
3872
3873Path to rsync executable on the client
3874
3875=item $Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';
3876
3877Full command to run rsync on the client machine.  The following variables
3878are substituted at run-time:
3879
3880       $host           host name being backed up
3881       $hostIP         host's IP address
3882       $shareName      share name to backup (ie: top-level directory path)
3883       $rsyncPath      same as $Conf{RsyncClientPath}
3884       $sshPath        same as $Conf{SshPath}
3885       $argList        argument list, built from $Conf{RsyncArgs},
3886                       $shareName, $Conf{BackupFilesExclude} and
3887                       $Conf{BackupFilesOnly}
3888
3889This setting only matters if $Conf{XferMethod} = 'rsync'.
3890
3891=item $Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';
3892
3893Full command to run rsync for restore on the client.  The following
3894variables are substituted at run-time:
3895
3896       $host           host name being backed up
3897       $hostIP         host's IP address
3898       $shareName      share name to backup (ie: top-level directory path)
3899       $rsyncPath      same as $Conf{RsyncClientPath}
3900       $sshPath        same as $Conf{SshPath}
3901       $argList        argument list, built from $Conf{RsyncArgs},
3902                       $shareName, $Conf{BackupFilesExclude} and
3903                       $Conf{BackupFilesOnly}
3904
3905This setting only matters if $Conf{XferMethod} = 'rsync'.
3906
3907Note: all Cmds are executed directly without a shell, so the prog name
3908needs to be a full path and you can't include shell syntax like
3909redirection and pipes; put that in a script if you need it.
3910
3911=item $Conf{RsyncShareName} = '/';
3912
3913Share name to backup.  For $Conf{XferMethod} = "rsync" this should
3914be a file system path, eg '/' or '/home'.
3915
3916For $Conf{XferMethod} = "rsyncd" this should be the name of the module
3917to backup (ie: the name from /etc/rsynd.conf).
3918
3919This can also be a list of multiple file system paths or modules.
3920For example, by adding --one-file-system to $Conf{RsyncArgs} you
3921can backup each file system separately, which makes restoring one
3922bad file system easier.  In this case you would list all of the mount
3923points:
3924
3925    $Conf{RsyncShareName} = ['/', '/var', '/data', '/boot'];
3926
3927=item $Conf{RsyncdClientPort} = 873;
3928
3929Rsync daemon port on the client, for $Conf{XferMethod} = "rsyncd".
3930
3931=item $Conf{RsyncdUserName} = '';
3932
3933Rsync daemon user name on client, for $Conf{XferMethod} = "rsyncd".
3934The user name and password are stored on the client in whatever file
3935the "secrets file" parameter in rsyncd.conf points to
3936(eg: /etc/rsyncd.secrets).
3937
3938=item $Conf{RsyncdPasswd} = '';
3939
3940Rsync daemon user name on client, for $Conf{XferMethod} = "rsyncd".
3941The user name and password are stored on the client in whatever file
3942the "secrets file" parameter in rsyncd.conf points to
3943(eg: /etc/rsyncd.secrets).
3944
3945=item $Conf{RsyncdAuthRequired} = 1;
3946
3947Whether authentication is mandatory when connecting to the client's
3948rsyncd.  By default this is on, ensuring that BackupPC will refuse to
3949connect to an rsyncd on the client that is not password protected.
3950Turn off at your own risk.
3951
3952=item $Conf{RsyncCsumCacheVerifyProb} = 0.01;
3953
3954When rsync checksum caching is enabled (by adding the
3955--checksum-seed=32761 option to $Conf{RsyncArgs}), the cached
3956checksums can be occasionally verified to make sure the file
3957contents matches the cached checksums.  This is to avoid the
3958risk that disk problems might cause the pool file contents to
3959get corrupted, but the cached checksums would make BackupPC
3960think that the file still matches the client.
3961
3962This setting is the probability (0 means never and 1 means always)
3963that a file will be rechecked.  Setting it to 0 means the checksums
3964will not be rechecked (unless there is a phase 0 failure).  Setting
3965it to 1 (ie: 100%) means all files will be checked, but that is
3966not a desirable setting since you are better off simply turning
3967caching off (ie: remove the --checksum-seed option).
3968
3969The default of 0.01 means 1% (on average) of the files during a full
3970backup will have their cached checksum re-checked.
3971
3972This setting has no effect unless checksum caching is turned on.
3973
3974=item $Conf{RsyncArgs} = [ ... ];
3975
3976Arguments to rsync for backup.  Do not edit the first set unless you
3977have a thorough understanding of how File::RsyncP works.
3978
3979=item $Conf{RsyncArgsExtra} = [];
3980
3981Additional arguments added to RsyncArgs.  This can be used in
3982conbination with $Conf{RsyncArgs} to allow customization of
3983the rsync arguments on a part-client basis.  The standard
3984arguments go in $Conf{RsyncArgs} and $Conf{RsyncArgsExtra}
3985can be set on a per-client basis.
3986
3987Examples of additional arguments that should work are --exclude/--include,
3988eg:
3989
3990    $Conf{RsyncArgsExtra} = [
3991          '--exclude', '/proc',
3992          '--exclude', '*.tmp',
3993    ];
3994
3995Both $Conf{RsyncArgs} and $Conf{RsyncArgsExtra} are subject
3996to the following variable substitutions:
3997
3998       $client       client name being backed up
3999       $host         host name (could be different from client name if
4000                                $Conf{ClientNameAlias} is set)
4001       $hostIP       IP address of host
4002       $confDir      configuration directory path
4003
4004This allows settings of the form:
4005
4006    $Conf{RsyncArgsExtra} = [
4007            '--exclude-from=$confDir/pc/$host.exclude',
4008    ];
4009
4010=item $Conf{RsyncRestoreArgs} = [ ... ];
4011
4012Arguments to rsync for restore.  Do not edit the first set unless you
4013have a thorough understanding of how File::RsyncP works.
4014
4015If you want to disable direct restores using rsync (eg: is the module
4016is read-only), you should set $Conf{RsyncRestoreArgs} to undef and
4017the corresponding CGI restore option will be removed.
4018
4019$Conf{RsyncRestoreArgs} is subject to the following variable
4020substitutions:
4021
4022       $client       client name being backed up
4023       $host         host name (could be different from client name if
4024                                $Conf{ClientNameAlias} is set)
4025       $hostIP       IP address of host
4026       $confDir      configuration directory path
4027
4028Note: $Conf{RsyncArgsExtra} doesn't apply to $Conf{RsyncRestoreArgs}.
4029
4030=back
4031
4032=head2 FTP Configuration
4033
4034=over 4
4035
4036=item $Conf{FtpShareName} = '';
4037
4038Which host directories to backup when using FTP.  This can be a
4039string or an array of strings if there are multiple shares per host.
4040
4041This value must be specified in one of two ways: either as a
4042subdirectory of the 'share root' on the server, or as the absolute
4043path of the directory.
4044
4045In the following example, if the directory /home/username is the
4046root share of the ftp server with the given username, the following
4047two values will back up the same directory:
4048
4049   $Conf{FtpShareName} = 'www';                # www directory
4050   $Conf{FtpShareName} = '/home/username/www'; # same directory
4051
4052Path resolution is not supported; i.e.; you may not have an ftp
4053share path defined as '../otheruser' or '~/games'.
4054
4055 Multiple shares may also be specified, as with other protocols:
4056
4057   $Conf{FtpShareName} = [ 'www',
4058                           'bin',
4059                           'config' ];
4060
4061Note also that you can also use $Conf{BackupFilesOnly} to specify
4062a specific list of directories to backup.  It's more efficient to
4063use this option instead of $Conf{FtpShareName} since a new tar is
4064run for each entry in $Conf{FtpShareName}.
4065
4066This setting only matters if $Conf{XferMethod} = 'ftp'.
4067
4068=item $Conf{FtpUserName} = '';
4069
4070FTP user name.  This is used to log into the server.
4071
4072This setting is used only if $Conf{XferMethod} = 'ftp'.
4073
4074=item $Conf{FtpPasswd} = '';
4075
4076FTP user password.  This is used to log into the server.
4077
4078This setting is used only if $Conf{XferMethod} = 'ftp'.
4079
4080=item $Conf{FtpPassive} = 1;
4081
4082Whether passive mode is used.  The correct setting depends upon
4083whether local or remote ports are accessible from the other machine,
4084which is affected by any firewall or routers between the FTP server
4085on the client and the BackupPC server.
4086
4087This setting is used only if $Conf{XferMethod} = 'ftp'.
4088
4089=item $Conf{FtpBlockSize} = 10240;
4090
4091Transfer block size. This sets the size of the amounts of data in
4092each frame. While undefined, this value takes the default value.
4093
4094This setting is used only if $Conf{XferMethod} = 'ftp'.
4095
4096=item $Conf{FtpPort} = 21;
4097
4098The port of the ftp server.  If undefined, 21 is used.
4099
4100This setting is used only if $Conf{XferMethod} = 'ftp'.
4101
4102=item $Conf{FtpTimeout} = 120;
4103
4104Connection timeout for FTP.  When undefined, the default is 120 seconds.
4105
4106This setting is used only if $Conf{XferMethod} = 'ftp'.
4107
4108=item $Conf{FtpFollowSymlinks} = 0;
4109
4110Behaviour when BackupPC encounters symlinks on the FTP share.
4111
4112Symlinks cannot be restored via FTP, so the desired behaviour will
4113be different depending on the setup of the share. The default for
4114this behavor is 1.  Directory shares with more complicated directory
4115structures should consider other protocols.
4116
4117=back
4118
4119=head2 Archive Configuration
4120
4121=over 4
4122
4123=item $Conf{ArchiveDest} = '/tmp';
4124
4125Archive Destination
4126
4127The Destination of the archive
4128e.g. /tmp for file archive or /dev/nst0 for device archive
4129
4130=item $Conf{ArchiveComp} = 'gzip';
4131
4132Archive Compression type
4133
4134The valid values are:
4135
4136  - 'none':  No Compression
4137
4138  - 'gzip':  Medium Compression. Recommended.
4139
4140  - 'bzip2': High Compression but takes longer.
4141
4142=item $Conf{ArchivePar} = 0;
4143
4144Archive Parity Files
4145
4146The amount of Parity data to generate, as a percentage
4147of the archive size.
4148Uses the commandline par2 (par2cmdline) available from
4149http://parchive.sourceforge.net
4150
4151Only useful for file dumps.
4152
4153Set to 0 to disable this feature.
4154
4155=item $Conf{ArchiveSplit} = 0;
4156
4157Archive Size Split
4158
4159Only for file archives. Splits the output into
4160the specified size * 1,000,000.
4161e.g. to split into 650,000,000 bytes, specify 650 below.
4162
4163If the value is 0, or if $Conf{ArchiveDest} is an existing file or
4164device (e.g. a streaming tape drive), this feature is disabled.
4165
4166=item $Conf{ArchiveClientCmd} = '$Installdir/bin/BackupPC_archiveHost' ...
4167
4168Archive Command
4169
4170This is the command that is called to actually run the archive process
4171for each host.  The following variables are substituted at run-time:
4172
4173  $Installdir    The installation directory of BackupPC
4174  $tarCreatePath The path to BackupPC_tarCreate
4175  $splitpath     The path to the split program
4176  $parpath       The path to the par2 program
4177  $host          The host to archive
4178  $backupnumber  The backup number of the host to archive
4179  $compression   The path to the compression program
4180  $compext       The extension assigned to the compression type
4181  $splitsize     The number of bytes to split archives into
4182  $archiveloc    The location to put the archive
4183  $parfile       The amount of parity data to create (percentage)
4184
4185Note: all Cmds are executed directly without a shell, so the prog name
4186needs to be a full path and you can't include shell syntax like
4187redirection and pipes; put that in a script if you need it.
4188
4189=item $Conf{SshPath} = '';
4190
4191Full path for ssh. Security caution: normal users should not
4192allowed to write to this file or directory.
4193
4194=item $Conf{NmbLookupPath} = '';
4195
4196Full path for nmblookup. Security caution: normal users should not
4197allowed to write to this file or directory.
4198
4199nmblookup is from the Samba distribution. nmblookup is used to get the
4200netbios name, necessary for DHCP hosts.
4201
4202=item $Conf{NmbLookupCmd} = '$nmbLookupPath -A $host';
4203
4204NmbLookup command.  Given an IP address, does an nmblookup on that
4205IP address.  The following variables are substituted at run-time:
4206
4207  $nmbLookupPath      path to nmblookup ($Conf{NmbLookupPath})
4208  $host               IP address
4209
4210This command is only used for DHCP hosts: given an IP address, this
4211command should try to find its NetBios name.
4212
4213Note: all Cmds are executed directly without a shell, so the prog name
4214needs to be a full path and you can't include shell syntax like
4215redirection and pipes; put that in a script if you need it.
4216
4217=item $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath $host';
4218
4219NmbLookup command.  Given a netbios name, finds that host by doing
4220a NetBios lookup.  Several variables are substituted at run-time:
4221
4222  $nmbLookupPath      path to nmblookup ($Conf{NmbLookupPath})
4223  $host               NetBios name
4224
4225In some cases you might need to change the broadcast address, for
4226example if nmblookup uses 192.168.255.255 by default and you find
4227that doesn't work, try 192.168.1.255 (or your equivalent class C
4228address) using the -B option:
4229
4230   $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath -B 192.168.1.255 $host';
4231
4232If you use a WINS server and your machines don't respond to
4233multicast NetBios requests you can use this (replace 1.2.3.4
4234with the IP address of your WINS server):
4235
4236   $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath -R -U 1.2.3.4 $host';
4237
4238This is preferred over multicast since it minimizes network traffic.
4239
4240Experiment manually for your site to see what form of nmblookup command
4241works.
4242
4243Note: all Cmds are executed directly without a shell, so the prog name
4244needs to be a full path and you can't include shell syntax like
4245redirection and pipes; put that in a script if you need it.
4246
4247=item $Conf{FixedIPNetBiosNameCheck} = 0;
4248
4249For fixed IP address hosts, BackupPC_dump can also verify the netbios
4250name to ensure it matches the host name.  An error is generated if
4251they do not match.  Typically this flag is off.  But if you are going
4252to transition a bunch of machines from fixed host addresses to DHCP,
4253setting this flag is a great way to verify that the machines have
4254their netbios name set correctly before turning on DCHP.
4255
4256=item $Conf{PingPath} = '';
4257
4258Full path to the ping command.  Security caution: normal users
4259should not be allowed to write to this file or directory.
4260
4261If you want to disable ping checking, set this to some program
4262that exits with 0 status, eg:
4263
4264    $Conf{PingPath} = '/bin/echo';
4265
4266=item $Conf{PingCmd} = '$pingPath -c 1 $host';
4267
4268Ping command.  The following variables are substituted at run-time:
4269
4270  $pingPath      path to ping ($Conf{PingPath})
4271  $host          host name
4272
4273Wade Brown reports that on solaris 2.6 and 2.7 ping -s returns the wrong
4274exit status (0 even on failure).  Replace with "ping $host 1", which
4275gets the correct exit status but we don't get the round-trip time.
4276
4277Note: all Cmds are executed directly without a shell, so the prog name
4278needs to be a full path and you can't include shell syntax like
4279redirection and pipes; put that in a script if you need it.
4280
4281=item $Conf{PingMaxMsec} = 20;
4282
4283Maximum round-trip ping time in milliseconds.  This threshold is set
4284to avoid backing up PCs that are remotely connected through WAN or
4285dialup connections.  The output from ping -s (assuming it is supported
4286on your system) is used to check the round-trip packet time.  On your
4287local LAN round-trip times should be much less than 20msec.  On most
4288WAN or dialup connections the round-trip time will be typically more
4289than 20msec.  Tune if necessary.
4290
4291=item $Conf{CompressLevel} = 0;
4292
4293Compression level to use on files.  0 means no compression.  Compression
4294levels can be from 1 (least cpu time, slightly worse compression) to
42959 (most cpu time, slightly better compression).  The recommended value
4296is 3.  Changing to 5, for example, will take maybe 20% more cpu time
4297and will get another 2-3% additional compression. See the zlib
4298documentation for more information about compression levels.
4299
4300Changing compression on or off after backups have already been done
4301will require both compressed and uncompressed pool files to be stored.
4302This will increase the pool storage requirements, at least until all
4303the old backups expire and are deleted.
4304
4305It is ok to change the compression value (from one non-zero value to
4306another non-zero value) after dumps are already done.  Since BackupPC
4307matches pool files by comparing the uncompressed versions, it will still
4308correctly match new incoming files against existing pool files.  The
4309new compression level will take effect only for new files that are
4310newly compressed and added to the pool.
4311
4312If compression was off and you are enabling compression for the first
4313time you can use the BackupPC_compressPool utility to compress the
4314pool.  This avoids having the pool grow to accommodate both compressed
4315and uncompressed backups.  See the documentation for more information.
4316
4317Note: compression needs the Compress::Zlib perl library.  If the
4318Compress::Zlib library can't be found then $Conf{CompressLevel} is
4319forced to 0 (compression off).
4320
4321=item $Conf{ClientTimeout} = 72000;
4322
4323Timeout in seconds when listening for the transport program's
4324(smbclient, tar etc) stdout. If no output is received during this
4325time, then it is assumed that something has wedged during a backup,
4326and the backup is terminated.
4327
4328Note that stdout buffering combined with huge files being backed up
4329could cause longish delays in the output from smbclient that
4330BackupPC_dump sees, so in rare cases you might want to increase
4331this value.
4332
4333Despite the name, this parameter sets the timeout for all transport
4334methods (tar, smb etc).
4335
4336=item $Conf{MaxOldPerPCLogFiles} = 12;
4337
4338Maximum number of log files we keep around in each PC's directory
4339(ie: pc/$host).  These files are aged monthly.  A setting of 12
4340means there will be at most the files LOG, LOG.0, LOG.1, ... LOG.11
4341in the pc/$host directory (ie: about a years worth).  (Except this
4342month's LOG, these files will have a .z extension if compression
4343is on).
4344
4345If you decrease this number after BackupPC has been running for a
4346while you will have to manually remove the older log files.
4347
4348=item $Conf{DumpPreUserCmd} = undef;
4349
4350=item $Conf{DumpPostUserCmd} = undef;
4351
4352=item $Conf{DumpPreShareCmd} = undef;
4353
4354=item $Conf{DumpPostShareCmd} = undef;
4355
4356=item $Conf{RestorePreUserCmd} = undef;
4357
4358=item $Conf{RestorePostUserCmd} = undef;
4359
4360=item $Conf{ArchivePreUserCmd} = undef;
4361
4362=item $Conf{ArchivePostUserCmd} = undef;
4363
4364Optional commands to run before and after dumps and restores,
4365and also before and after each share of a dump.
4366
4367Stdout from these commands will be written to the Xfer (or Restore)
4368log file.  One example of using these commands would be to
4369shut down and restart a database server, dump a database
4370to files for backup, or doing a snapshot of a share prior
4371to a backup.  Example:
4372
4373
4374   $Conf{DumpPreUserCmd} = '$sshPath -q -x -l root $host /usr/bin/dumpMysql';
4375
4376The following variable substitutions are made at run time for
4377$Conf{DumpPreUserCmd}, $Conf{DumpPostUserCmd}, $Conf{DumpPreShareCmd}
4378and $Conf{DumpPostShareCmd}:
4379
4380       $type         type of dump (incr or full)
4381       $xferOK       1 if the dump succeeded, 0 if it didn't
4382       $client       client name being backed up
4383       $host         host name (could be different from client name if
4384                                $Conf{ClientNameAlias} is set)
4385       $hostIP       IP address of host
4386       $user         user name from the hosts file
4387       $moreUsers    list of additional users from the hosts file
4388       $share        the first share name (or current share for
4389                       $Conf{DumpPreShareCmd} and $Conf{DumpPostShareCmd})
4390       $shares       list of all the share names
4391       $XferMethod   value of $Conf{XferMethod} (eg: tar, rsync, smb)
4392       $sshPath      value of $Conf{SshPath},
4393       $cmdType      set to DumpPreUserCmd or DumpPostUserCmd
4394
4395The following variable substitutions are made at run time for
4396$Conf{RestorePreUserCmd} and $Conf{RestorePostUserCmd}:
4397
4398       $client       client name being backed up
4399       $xferOK       1 if the restore succeeded, 0 if it didn't
4400       $host         host name (could be different from client name if
4401                                $Conf{ClientNameAlias} is set)
4402       $hostIP       IP address of host
4403       $user         user name from the hosts file
4404       $moreUsers    list of additional users from the hosts file
4405       $share        the first share name
4406       $XferMethod   value of $Conf{XferMethod} (eg: tar, rsync, smb)
4407       $sshPath      value of $Conf{SshPath},
4408       $type         set to "restore"
4409       $bkupSrcHost  host name of the restore source
4410       $bkupSrcShare share name of the restore source
4411       $bkupSrcNum   backup number of the restore source
4412       $pathHdrSrc   common starting path of restore source
4413       $pathHdrDest  common starting path of destination
4414       $fileList     list of files being restored
4415       $cmdType      set to RestorePreUserCmd or RestorePostUserCmd
4416
4417The following variable substitutions are made at run time for
4418$Conf{ArchivePreUserCmd} and $Conf{ArchivePostUserCmd}:
4419
4420       $client       client name being backed up
4421       $xferOK       1 if the archive succeeded, 0 if it didn't
4422       $host         Name of the archive host
4423       $user         user name from the hosts file
4424       $share        the first share name
4425       $XferMethod   value of $Conf{XferMethod} (eg: tar, rsync, smb)
4426       $HostList     list of hosts being archived
4427       $BackupList   list of backup numbers for the hosts being archived
4428       $archiveloc   location where the archive is sent to
4429       $parfile      amount of parity data being generated (percentage)
4430       $compression  compression program being used (eg: cat, gzip, bzip2)
4431       $compext      extension used for compression type (eg: raw, gz, bz2)
4432       $splitsize    size of the files that the archive creates
4433       $sshPath      value of $Conf{SshPath},
4434       $type         set to "archive"
4435       $cmdType      set to ArchivePreUserCmd or ArchivePostUserCmd
4436
4437Note: all Cmds are executed directly without a shell, so the prog name
4438needs to be a full path and you can't include shell syntax like
4439redirection and pipes; put that in a script if you need it.
4440
4441=item $Conf{UserCmdCheckStatus} = 0;
4442
4443Whether the exit status of each PreUserCmd and
4444PostUserCmd is checked.
4445
4446If set and the Dump/Restore/Archive Pre/Post UserCmd
4447returns a non-zero exit status then the dump/restore/archive
4448is aborted.  To maintain backward compatibility (where
4449the exit status in early versions was always ignored),
4450this flag defaults to 0.
4451
4452If this flag is set and the Dump/Restore/Archive PreUserCmd
4453fails then the matching Dump/Restore/Archive PostUserCmd is
4454not executed.  If DumpPreShareCmd returns a non-exit status,
4455then DumpPostShareCmd is not executed, but the DumpPostUserCmd
4456is still run (since DumpPreUserCmd must have previously
4457succeeded).
4458
4459An example of a DumpPreUserCmd that might fail is a script
4460that snapshots or dumps a database which fails because
4461of some database error.
4462
4463=item $Conf{ClientNameAlias} = undef;
4464
4465Override the client's host name.  This allows multiple clients
4466to all refer to the same physical host.  This should only be
4467set in the per-PC config file and is only used by BackupPC at
4468the last moment prior to generating the command used to backup
4469that machine (ie: the value of $Conf{ClientNameAlias} is invisible
4470everywhere else in BackupPC).  The setting can be a host name or
4471IP address, eg:
4472
4473        $Conf{ClientNameAlias} = 'realHostName';
4474        $Conf{ClientNameAlias} = '192.1.1.15';
4475
4476will cause the relevant smb/tar/rsync backup/restore commands to be
4477directed to realHostName, not the client name.
4478
4479Note: this setting doesn't work for hosts with DHCP set to 1.
4480
4481=back
4482
4483=head2 Email reminders, status and messages
4484
4485=over 4
4486
4487=item $Conf{SendmailPath} = '';
4488
4489Full path to the sendmail command.  Security caution: normal users
4490should not allowed to write to this file or directory.
4491
4492=item $Conf{EMailNotifyMinDays} = 2.5;
4493
4494Minimum period between consecutive emails to a single user.
4495This tries to keep annoying email to users to a reasonable
4496level.  Email checks are done nightly, so this number is effectively
4497rounded up (ie: 2.5 means a user will never receive email more
4498than once every 3 days).
4499
4500=item $Conf{EMailFromUserName} = '';
4501
4502Name to use as the "from" name for email.  Depending upon your mail
4503handler this is either a plain name (eg: "admin") or a fully-qualified
4504name (eg: "admin@mydomain.com").
4505
4506=item $Conf{EMailAdminUserName} = '';
4507
4508Destination address to an administrative user who will receive a
4509nightly email with warnings and errors.  If there are no warnings
4510or errors then no email will be sent.  Depending upon your mail
4511handler this is either a plain name (eg: "admin") or a fully-qualified
4512name (eg: "admin@mydomain.com").
4513
4514=item $Conf{EMailUserDestDomain} = '';
4515
4516Destination domain name for email sent to users.  By default
4517this is empty, meaning email is sent to plain, unqualified
4518addresses.  Otherwise, set it to the destintation domain, eg:
4519
4520   $Cong{EMailUserDestDomain} = '@mydomain.com';
4521
4522With this setting user email will be set to 'user@mydomain.com'.
4523
4524=item $Conf{EMailNoBackupEverSubj} = undef;
4525
4526=item $Conf{EMailNoBackupEverMesg} = undef;
4527
4528This subject and message is sent to a user if their PC has never been
4529backed up.
4530
4531These values are language-dependent.  The default versions can be
4532found in the language file (eg: lib/BackupPC/Lang/en.pm).  If you
4533need to change the message, copy it here and edit it, eg:
4534
4535  $Conf{EMailNoBackupEverMesg} = <<'EOF';
4536  To: $user$domain
4537  cc:
4538  Subject: $subj
4539
4540  Dear $userName,
4541
4542  This is a site-specific email message.
4543  EOF
4544
4545=item $Conf{EMailNotifyOldBackupDays} = 7.0;
4546
4547How old the most recent backup has to be before notifying user.
4548When there have been no backups in this number of days the user
4549is sent an email.
4550
4551=item $Conf{EMailNoBackupRecentSubj} = undef;
4552
4553=item $Conf{EMailNoBackupRecentMesg} = undef;
4554
4555This subject and message is sent to a user if their PC has not recently
4556been backed up (ie: more than $Conf{EMailNotifyOldBackupDays} days ago).
4557
4558These values are language-dependent.  The default versions can be
4559found in the language file (eg: lib/BackupPC/Lang/en.pm).  If you
4560need to change the message, copy it here and edit it, eg:
4561
4562  $Conf{EMailNoBackupRecentMesg} = <<'EOF';
4563  To: $user$domain
4564  cc:
4565  Subject: $subj
4566
4567  Dear $userName,
4568
4569  This is a site-specific email message.
4570  EOF
4571
4572=item $Conf{EMailNotifyOldOutlookDays} = 5.0;
4573
4574How old the most recent backup of Outlook files has to be before
4575notifying user.
4576
4577=item $Conf{EMailOutlookBackupSubj} = undef;
4578
4579=item $Conf{EMailOutlookBackupMesg} = undef;
4580
4581This subject and message is sent to a user if their Outlook files have
4582not recently been backed up (ie: more than $Conf{EMailNotifyOldOutlookDays}
4583days ago).
4584
4585These values are language-dependent.  The default versions can be
4586found in the language file (eg: lib/BackupPC/Lang/en.pm).  If you
4587need to change the message, copy it here and edit it, eg:
4588
4589  $Conf{EMailOutlookBackupMesg} = <<'EOF';
4590  To: $user$domain
4591  cc:
4592  Subject: $subj
4593
4594  Dear $userName,
4595
4596  This is a site-specific email message.
4597  EOF
4598
4599=item $Conf{EMailHeaders} = <<EOF;
4600
4601Additional email headers.  This sets to charset to
4602utf8.
4603
4604=back
4605
4606=head2 CGI user interface configuration settings
4607
4608=over 4
4609
4610=item $Conf{CgiAdminUserGroup} = '';
4611
4612=item $Conf{CgiAdminUsers} = '';
4613
4614Normal users can only access information specific to their host.
4615They can start/stop/browse/restore backups.
4616
4617Administrative users have full access to all hosts, plus overall
4618status and log information.
4619
4620The administrative users are the union of the unix/linux group
4621$Conf{CgiAdminUserGroup} and the manual list of users, separated
4622by spaces, in $Conf{CgiAdminUsers}. If you don't want a group or
4623manual list of users set the corresponding configuration setting
4624to undef or an empty string.
4625
4626If you want every user to have admin privileges (careful!), set
4627$Conf{CgiAdminUsers} = '*'.
4628
4629Examples:
4630
4631   $Conf{CgiAdminUserGroup} = 'admin';
4632   $Conf{CgiAdminUsers}     = 'craig celia';
4633   --> administrative users are the union of group admin, plus
4634     craig and celia.
4635
4636   $Conf{CgiAdminUserGroup} = '';
4637   $Conf{CgiAdminUsers}     = 'craig celia';
4638   --> administrative users are only craig and celia'.
4639
4640=item $Conf{CgiURL} = undef;
4641
4642URL of the BackupPC_Admin CGI script.  Used for email messages.
4643
4644=item $Conf{Language} = 'en';
4645
4646Language to use.  See lib/BackupPC/Lang for the list of supported
4647languages, which include English (en), French (fr), Spanish (es),
4648German (de), Italian (it), Dutch (nl), Polish (pl), Portuguese
4649Brazillian (pt_br) and Chinese (zh_CH).
4650
4651Currently the Language setting applies to the CGI interface and email
4652messages sent to users.  Log files and other text are still in English.
4653
4654=item $Conf{CgiUserHomePageCheck} = '';
4655
4656=item $Conf{CgiUserUrlCreate} = 'mailto:%s';
4657
4658User names that are rendered by the CGI interface can be turned
4659into links into their home page or other information about the
4660user.  To set this up you need to create two sprintf() strings,
4661that each contain a single '%s' that will be replaced by the user
4662name.  The default is a mailto: link.
4663
4664$Conf{CgiUserHomePageCheck} should be an absolute file path that
4665is used to check (via "-f") that the user has a valid home page.
4666Set this to undef or an empty string to turn off this check.
4667
4668$Conf{CgiUserUrlCreate} should be a full URL that points to the
4669user's home page.  Set this to undef or an empty string to turn
4670off generation of URLs for user names.
4671
4672Example:
4673
4674   $Conf{CgiUserHomePageCheck} = '/var/www/html/users/%s.html';
4675   $Conf{CgiUserUrlCreate}     = 'http://myhost/users/%s.html';
4676   --> if /var/www/html/users/craig.html exists, then 'craig' will
4677     be rendered as a link to http://myhost/users/craig.html.
4678
4679=item $Conf{CgiDateFormatMMDD} = 1;
4680
4681Date display format for CGI interface.  A value of 1 uses US-style
4682dates (MM/DD), a value of 2 uses full YYYY-MM-DD format, and zero
4683for international dates (DD/MM).
4684
4685=item $Conf{CgiNavBarAdminAllHosts} = 1;
4686
4687If set, the complete list of hosts appears in the left navigation
4688bar pull-down for administrators.  Otherwise, just the hosts for which
4689the user is listed in the host file (as either the user or in moreUsers)
4690are displayed.
4691
4692=item $Conf{CgiSearchBoxEnable} = 1;
4693
4694Enable/disable the search box in the navigation bar.
4695
4696=item $Conf{CgiNavBarLinks} = [ ... ];
4697
4698Additional navigation bar links.  These appear for both regular users
4699and administrators.  This is a list of hashes giving the link (URL)
4700and the text (name) for the link.  Specifying lname instead of name
4701uses the language specific string (ie: $Lang->{lname}) instead of
4702just literally displaying name.
4703
4704=item $Conf{CgiStatusHilightColor} = { ...
4705
4706Hilight colors based on status that are used in the PC summary page.
4707
4708=item $Conf{CgiHeaders} = '<meta http-equiv="pragma" content="no-cache">';
4709
4710Additional CGI header text.
4711
4712=item $Conf{CgiImageDir} = '';
4713
4714Directory where images are stored.  This directory should be below
4715Apache's DocumentRoot.  This value isn't used by BackupPC but is
4716used by configure.pl when you upgrade BackupPC.
4717
4718Example:
4719
4720    $Conf{CgiImageDir} = '/var/www/htdocs/BackupPC';
4721
4722=item $Conf{CgiExt2ContentType} = { };
4723
4724Additional mappings of file name extenions to Content-Type for
4725individual file restore.  See $Ext2ContentType in BackupPC_Admin
4726for the default setting.  You can add additional settings here,
4727or override any default settings.  Example:
4728
4729
4730    $Conf{CgiExt2ContentType} = {
4731                'pl'  => 'text/plain',
4732         };
4733
4734=item $Conf{CgiImageDirURL} = '';
4735
4736URL (without the leading http://host) for BackupPC's image directory.
4737The CGI script uses this value to serve up image files.
4738
4739Example:
4740
4741    $Conf{CgiImageDirURL} = '/BackupPC';
4742
4743=item $Conf{CgiCSSFile} = 'BackupPC_stnd.css';
4744
4745CSS stylesheet "skin" for the CGI interface.  It is stored
4746in the $Conf{CgiImageDir} directory and accessed via the
4747$Conf{CgiImageDirURL} URL.
4748
4749For BackupPC v3.x several color, layout and font changes were made.
4750The previous v2.x version is available as BackupPC_stnd_orig.css, so
4751if you prefer the old skin, change this to BackupPC_stnd_orig.css.
4752
4753=item $Conf{CgiUserConfigEditEnable} = 1;
4754
4755Whether the user is allowed to edit their per-PC config.
4756
4757=item $Conf{CgiUserConfigEdit} = { ...
4758
4759Which per-host config variables a non-admin user is allowed
4760to edit.  Admin users can edit all per-host config variables,
4761even if disabled in this list.
4762
4763SECURITY WARNING: Do not let users edit any of the Cmd
4764config variables!  That's because a user could set a
4765Cmd to a shell script of their choice and it will be
4766run as the BackupPC user.  That script could do all
4767sorts of bad things.
4768
4769=back
4770
4771
4772=head1 Version Numbers
4773
4774Starting with v1.4.0 BackupPC uses a X.Y.Z version numbering system,
4775instead of X.0Y. The first digit is for major new releases, the middle
4776digit is for significant feature releases and improvements (most of
4777the releases have been in this category), and the last digit is for
4778bug fixes. You should think of the old 1.00, 1.01, 1.02 and 1.03 as
47791.0.0, 1.1.0, 1.2.0 and 1.3.0.
4780
4781Additionally, patches might be made available.  A patched version
4782number is of the form X.Y.ZplN (eg: 2.1.0pl2), where N is the
4783patch level.
4784
4785=head1 Author
4786
4787Craig Barratt  <cbarratt@users.sourceforge.net>
4788
4789See L<http://backuppc.sourceforge.net>.
4790
4791=head1 Copyright
4792
4793Copyright (C) 2001-2015 Craig Barratt
4794
4795=head1 Credits
4796
4797Ryan Kucera contributed the directory navigation code and images
4798for v1.5.0.  He contributed the first skeleton of BackupPC_restore.
4799He also added a significant revision to the CGI interface, including
4800CSS tags, in v2.1.0, and designed the BackupPC logo.
4801
4802Xavier Nicollet, with additions from Guillaume Filion, added the
4803internationalization (i18n) support to the CGI interface for v2.0.0.
4804Xavier provided the French translation fr.pm, with additions from
4805Guillaume.
4806
4807Guillaume Filion wrote BackupPC_zipCreate and added the CGI support
4808for zip download, in addition to some CGI cleanup, for v1.5.0.
4809Guillaume continues to support fr.pm updates for each new version.
4810
4811Josh Marshall implemented the Archive feature in v2.1.0.
4812
4813Ludovic Drolez supports the BackupPC Debian package.
4814
4815Javier Gonzalez provided the Spanish translation, es.pm for v2.0.0.
4816
4817Manfred Herrmann provided the German translation, de.pm for v2.0.0.
4818Manfred continues to support de.pm updates for each new version,
4819together with some help from Ralph Pa�gang.
4820
4821Lorenzo Cappelletti provided the Italian translation, it.pm for v2.1.0.
4822Giuseppe Iuculano and Vittorio Macchi updated it for 3.0.0.
4823
4824Lieven Bridts provided the Dutch translation, nl.pm, for v2.1.0,
4825with some tweaks from Guus Houtzager, and updates for 3.0.0.
4826
4827Reginaldo Ferreira provided the Portuguese Brazillian translation
4828pt_br.pm for v2.2.0.
4829
4830Rich Duzenbury provided the RSS feed option to the CGI interface.
4831
4832Jono Woodhouse from CapeSoft Software (www.capesoft.com) provided a
4833new CSS skin for 3.0.0 with several layout improvements.  Sean Cameron
4834(also from CapeSoft) designed new and more compact file icons for 3.0.0.
4835
4836Youlin Feng provided the Chinese translation for 3.1.0.
4837
4838Karol 'Semper' Stelmaczonek provided the Polish translation for 3.1.0.
4839
4840Jeremy Tietsort provided the host summary table sorting feature for 3.1.0.
4841
4842Paul Mantz contributed the ftp Xfer method for 3.2.0.
4843
4844Petr Pokorny provided the Czech translation for 3.2.1.
4845
4846Rikiya Yamamoto provided the Japanese translation for 3.3.0.
4847
4848Yakim provided the Ukrainian translation for 3.3.0.
4849
4850Sergei Butakov provided the Russian translation for 3.3.0.
4851
4852Many people have reported bugs, made useful suggestions and helped
4853with testing; see the ChangeLog and the mailing lists.
4854
4855Your name could appear here in the next version!
4856
4857=head1 License
4858
4859This program is free software; you can redistribute it and/or modify it
4860under the terms of the GNU General Public License as published by the
4861Free Software Foundation; either version 2 of the License, or (at your
4862option) any later version.
4863
4864This program is distributed in the hope that it will be useful,
4865but WITHOUT ANY WARRANTY; without even the implied warranty of
4866MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4867General Public License for more details.
4868
4869You should have received a copy of the GNU General Public License in the
4870LICENSE file along with this program; if not, write to the Free Software
4871Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
4872