Sambabackup

Current version 0.7

Description

Sambabackup is a perl-script that backup all the clients you specify in your Windows environment. You can run it from either cron or just in shell. It uses the SMB-connection that Samba offer through its mount.smbfs feature to mount a list of computers which you specify in the configure file and copy (zip) those directories to your Samba/Linux server. It also includes features as winpopmessage to users to inform them about whats going on to their files and logging of succeeded and failed backup-attempts to a separate logfile (/var/log/sambabackup.log). I have restricted the script to only allow root to run it, but that could probably be altered if its required.

Requirements

Download

Download the script in gzip-format: sambabackup.tar.gz
View the script with syntax-highlighting: sambabackup

Examples

Backup one client and directory

Say, you want to backup a directory at //bart/d called D:\perl\doc\faq with user lisa and password simpson.

sambabackup bart d perl/doc/faq lisa simpson

Now this directory will be copied and zipped down to the directory specified in the script with the filename bart_lisa.zip

Backup multiple clients and users

If you have a long list of clients and users which you want to backup in a simple way, just add these to the configfile sambabackup.conf like this:

sambabackup.conf
bart:linklas:passwd:d:Documents and Settings/linklas.BART:0
bart:mojaco:passwd:d:Documents and Settings/mojaco:0
bart:mojaco:passwd:d:Palm:0
lisa:pedro:passwd:c:perldoc/faq:0
marge:mojaco:passwd:d:Arkiv:0

When this file is complete and you have specified the path to it in the script, you just run this command in shell or add it to your crontab (or even better, CFengine).

sambabackup --cron

Now when the process of backing up you entire workgroup is going on, you can just relax and reach for your rather hot cup of coffee. If you feel like, you can monitor the process with tail -f /var/log/sambabackup.log.

Information for Windows XP users

It seems like Microsoft has changed their file-permission rules from Win2000 to WinXP. It is no longer possible for restricted users to share their Documents and Settings folder
without beeing an Administrator. This means that if you want to backup this directory you have to give these users Administrator-rights or copy these files to
another folder before backing up. Please arrest me if this isn’t true.

Note

The passwords to the users in the sambabackup.conf are not encrypted and this file has to be handled with care. I recommend you to always "chmod 700" this file so no one else than you (IMHO root) can read it.


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!