How To Backup SAMBA Server Configuration

Hi Experts,

Samba noob here. I currently have Debian 7 with Samba 3.6.6 installed.  I've been looking around for tutorials on backing up my Samba server. I have purchased a book call The Official Samba-3 Howto and Reference Guide but was hoping to make some progress on my own before it arrives.

All I've found are the following websites:
1. Can't find the backup script in the following website.

2. Don't understand the part about the SIDs on this website here...

Please help point me in the right direction.

Many Thanks
Ronniel Allan CastanitoIT ManagerAsked:
Who is Participating?
Ronniel Allan CastanitoConnect With a Mentor IT ManagerAuthor Commented:

Backup Procedure

On The Old Machine - Backup Samba Database & Config File

Backup Samba Database

1. Create backup archive directory
myserver1# mkdir /backup

2. Stop Samba service before performing the database backup
myserver1# service samba stop

3. Backp the trivial database located in /var/lib/samba.
myserver1# cd /var/lib/samba

4. Use the Samba tdbbackup utility to backup .tdb files. *.bak files will be created in the current location.
myserver1# tdbbackup *.tdb

5. Save a tar ball to /backup directory.
myserver1# tar -cvpzf /backup/sambadb.tar.gz *.bak

6. No longer require .bak files, just delete them.
myserver1# rm *.bak

Open in new window

Backup Samba Configuration Files

7. Backup config files located in /etc/samba
myserver1# cd /etc/samba

8. Save a tar ball of the config files to /backup directory
myserver1# tar -cvpzf /backup/sambaconf.tar.gz *

Open in new window

On The New Machine - Restore Samba Database & Config File

9. Create backup dump directory
myserver2# mkdir /dumpbkp

10. Copy backup files from Old machine over SSH.
myserver2# scp username@old_server_ip:/backup/* /dumpbkp

11. Stop Samba server running on the new machine.
myserver2# service samba stop

12. Extract tar ball containing the samba database.
myserver2# cd /dumpbkp
myserver2# tar -xvzf sambadb.tar.gz -C /var/lib/samba

13. Extract tar ball containing the samba config files.
myserver2# tar -xvzf sambaconf.tar.gz -C /etc/samba

14. Startup the Samba service.
myserver2# service samba start

Open in new window

The End.
The 2 sites indeed are pointing to a right direction. You have to tell us which portion you are not finding in these 2 sites to be right.......

"Can't find the backup script in the following website"--> what do you mean by this? Is it not written that---

 "The backup script of samba isn't installed, when you run 'make install'. It's recommented that you copy it from the sources directory (source4/scripting/bin/samba_backup) to your system, like /usr/sbin, and set secure permissions: "

If you know samba well, you know where the directories and files are, just cp the directories and files......... that's all.....

Ronniel Allan CastanitoIT ManagerAuthor Commented:
Thanks for posting surbabu. What is your approach to backing up Samba server?
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Ronniel Allan CastanitoIT ManagerAuthor Commented:
Would you know of any other useful website? ones suitable for noobs?
Ronniel Allan CastanitoIT ManagerAuthor Commented:
Are there any thing to watch out for when performing the backup?
just copying the directories and files would do, nothing else is required. In the backup script also, you need to mention the location and the script will only work if your installation is in the same directory.
The samba configuration files live in a directory called /etc/samba - just backup that directory.
Ronniel Allan CastanitoIT ManagerAuthor Commented:
what about the  *.tdb files as mentioned in the 2nd website?
Ronniel Allan CastanitoIT ManagerAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for RiCzN's comment #a39516912

for the following reason:

It works.
Point should be awarded to  RiCzN. I guess deletion will be a wrong action here.
Point should be awarded to  RiCzN. I guess deletion will be a wrong action here.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.