Changes

Jump to navigation Jump to search
6,247 bytes added ,  15:58, 1 May 2018
Line 229: Line 229:     
et vous avez fini.
 
et vous avez fini.
 +
 +
====Backup a Linux host through rsync====
 +
 +
To configure a Linux host client to be backed up, configure SSH from the backup server as follows in order to exchange certificates and to perform a login without passwords.
 +
 +
At the BackupPC server command line as root:
 +
 +
su -s /bin/bash backuppc
 +
ssh-keygen -t rsa -b 2048  # use a blank passphrase
 +
exit
 +
 +
Assuming SSH access to the remote host to be backed up is already configured, as root:
 +
su -s /bin/bash backuppc
 +
ssh-copy-id -i ~backuppc/.ssh/id_rsa.pub root@your.host.name
 +
exit
 +
 +
You can test the key exchange:
 +
 +
su -s /bin/bash backuppc  #become backuppc user
 +
ssh -l root your.host.name                                                    # add "-p 2222" for port 2222
 +
exit                      #from the remote_host
 +
exit                      #from the backuppc user back to root
 +
 +
You should be able to log in without a password.
 +
 +
Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.<br />
 +
 +
Now you can go to the admin backuppc panel to set your host<br />
 +
 +
====Backup a Windows Client with rsync====
 +
 +
To configure a Windows client to be backed up via rsync, install rsync on the Windows client.  rysnc needs to be running as a service on the Windows client to ensure communication.
 +
There are several options/versions of rsync – the first I was able to get working was from http://sourceforge.net/projects/backuppc/files/cygwin-rsyncd/2.6.8_0/
 +
The zip file contains 7 files – the site goes into more detail about each of the files.  Depending on how you wish to use BackupPC will determine which files to edit.
 +
I use rsync without ssh keys – to do so create a local user with sufficient rights to the directory or directories on the Windows client, then edit the file rsync.secrets to include the UserID & Password.  You then use that same UserID & Password within the configuration from the BackupPC webpage – where you chose to back-up the client with Samba, rsync etc. The contents of rsync.secrets file is simply:
 +
  UserID:Password
 +
You will have to create a “Cygwin share” on the Windows box – that is done using the rsync.conf file.  The “Cygwin share” is the name you choose within the square brackets.  My rsync.conf file with a share name of “cdocs” (after removal of all personal information of course) looks like this:
 +
[cdocs]
 +
    path = c:/User
 +
    comment = c: Drive documents
 +
    auth users = <valid-back-up-user>
 +
    secrets file = c:/rsyncd/rsyncd.secrets
 +
    hosts allow = 192.168.1.1
 +
    strict modes = false
 +
    read only = true
 +
    list = false
 +
 +
We have share name (cdocs), path, the valid user created on the Windows client, the path to the rysnc.secrets file, an allowable host (this being the local backup server IP), modes, read only and list.  The options are mostly explained in the file – what it doesn’t show is that if you have a different version of rsync, the rsync.conf file looks a bit different.  This one is for rsync 3.0.9
 +
[cdocs]
 +
  Path = /cygdrive/c/Users/<USERNAME>
 +
  comment = c: User Data
 +
  strict modes = false
 +
  auth users = <valid-back-up-user>
 +
  secrets file = c:/rsyncd/rsyncd.secrets
 +
  hosts allow = 192.168.1.1
 +
  read only = false
 +
  list = false
 +
 +
The final thing that must happen to make rsync work properly is to load rysnc as a service on the Windows client.  The file service.bat shows the following command to accomplish this:
 +
c:/rsyncd/rsync.exe -a "--config=c:/rsyncd/rsyncd.conf --daemon --no-detach"
 +
 +
There is also a “gotcha” – sometimes port 873 is blocked by Windows Firewall, so you may need to fix that.
 +
 +
====Remove backups====
 +
*Remove all backups of a client
 +
rm -rf /var/lib/BackupPC/pc/<client>/
 +
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run
 +
 +
*Remove One backup of a client
 +
cd /var/lib/BackupPC/pc/<client>/
 +
ls
 +
rm -fR <backup_number>
 +
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run
 +
 +
{{warning box|
 +
Removing a single backup must be done with extreme care. You can safly remove the last backup for example, but if you remove a backup on which another one is based on, you can screw up your backups
 +
}}
 +
 +
After this, you will see space reclaimed and you can check it with df, but you still need to remove statistic line, otherwise you will see it in your web interface. To do that:
 +
 +
nano /var/lib/BackupPC/pc/<client>/backups
 +
With ctrl+k you can remove the line with <backup_number>.
 +
 +
Relog to your web interface and voila! No more <backup_number>.
 +
 +
===Known Issues===
 +
 +
* When restarting the BackupPC service you may receive the error as indicated below :<br />
 +
'''
 +
[root@backuppc ~]# service backuppc restart<br />
 +
 +
Shutting down BackupPC:                                    [  OK  ]
 +
Starting BackupPC:                                        [  OK  ]
 +
'''BackupPC: WARNING:  Your BackupPC $Conf{TopDir} is not listed in the locate
 +
BackupPC: database configuration's PRUNEPATHS.  This may cause all of your
 +
BackupPC: backed up files to be indexed!'''
 +
'''To remove the warning''' <br />
 +
 +
you should create a custom template '''/etc/e-smith/templates-custom/etc/updatedb.conf/10conf''' (copy the default /etc/e-smith/templates/etc/updatedb.conf/10conf)<br />
 +
mkdir -p /etc/e-smith/templates-custom/etc/updatedb.conf/
 +
cp /etc/e-smith/templates/etc/updatedb.conf/10conf /etc/e-smith/templates-custom/etc/updatedb.conf/
 +
 +
add the directory /var/lib/BackupPC to the PRUNEPATHS list, then
 +
expand-template /etc/updatedb.conf
 +
 +
* “aborted by signal=PIPE”
 +
Sometime the backup fails with this error, this error is related to the remote ssh service. You must set in the /etc/ssh/ssh_config of your remote host
 +
 +
  ServerAliveInterval 120
 +
 +
then restart your ssh service
 +
 +
One other way could be to set in the setting of backupPC (RsyncClientCmd)the default value for all hosts
 +
$Conf{RsyncClientCmd} = '$sshPath -o ServerAliveInterval=120 -q -x -l root $host $rsyncPath $argList+';
 +
 +
* trying backing up a SME Server you might encounter error or timeout on ssh, this is because of the AutoBlock fucntion on sshd
 +
config setprop sshd AutoBlock disabled
 +
signal-event remoteaccess-update
    
=== Désinstaller ===
 
=== Désinstaller ===
3,054

edits

Navigation menu