Jump to Navigation

How to configure email for BackupPC

BackupPC is a great piece of software that makes the setup and management of backups of servers and workstations a breeze. If configured correctly it will allow for a complete disaster recovery solution. Since it primarily backs ups to disk it is also a cheap, or cost-effective solution. One of the steps often left out of the many setup guides for backuppc on the internet is configuring mail for sending event notifications.

 By default bakcuppc expects there to be a configured smtp server on the machine on which it runs. Most often this is not the case and who wants to setup an entire smtp server just so Backuppc can send email?

The quick way to sort this out is to install a package like nbsmtp.

  • Just do a "apt-get install nbsmtp" on any debian based distro such as Ubuntu.
  • Next copy the /etc/nbsmtprc file to backuppc home directory with "cp /etc/nbsmtprc /var/lib/backuppc/.nbsmtp" note the period(.) in front of the name to make it a hidden file. To check your backuppc users home directory look in /etc/passwd.
  • Now edit the file with "vi /var/lib/backuppc/.nbsmtp" and uncomment and edit the "relayhost", "fromaddr" and "domain" entries as appropriate for your smtp server. If your smtp server requires authentication you will need to uncomment and edit the username/password entries as well.
  • If you now run "BackupPC_sendEmail -u <test@test.co.za>" you will probably get an error. This is because the perl "BackupPC_sendEmail" has some parameters it wants to send that are not accepted by nbsmtp.We will need to edit the BackupPC_sendEmail script. Remove the "-t" option from  the lines indicated below:
    •  print("Sending test email using $Conf{SendmailPath} -t $from\n")
    •  if ( !open(MAIL, "|$Conf{SendmailPath} -t $from") ) {

    Thats all there is to it. :)

Open Source: 

Comments

Under step 2, one should execute
"cp /etc/nbsmtprc /var/lib/backuppc/.nbsmtprc"
and not
"cp /etc/nbsmtprc /var/lib/backuppc/.nbsmtp",
since according to the documentation of nbsmtp, the per-user local configuration file should be named '.nbsmtprc' and not '.nbsmtp'.

Otherwise it worked, thanks!

Ok, i don't know what is my mistake, but after doing so my /etc/aliases became useless, earlier with sendmail, i was able to send mail to backuppc and its being resolved to myrealmail@myisp.com which exist in aliases:
backuppc: mymail

now its not working, any help please.

You didn't give any information on actually how to edit that script.

Edited it using vi I think. Its been a while since I did this so can't remember exactly but any one of the editors in Linux should work.



by Dr. Radut.