Directory Replication

Revision as of 03:02, 15 January 2013 by Doublez13 (talk | contribs) (Beginnings of the tutorial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


The following is a simple configuration for synchronizing the directories of two Linux servers that are tied to Samba shares. This can be looked at as a very simple implementation of directory replication, including the "poor mans" namespace. In this configuration, we use a third a party program called Unison to implement simple two way replication between servers. More information about Unison, including detailed manuals and setup information can be found on their website.

In this setup, we will be using two servers that utilize the local Linux authentication scheme (/etc/passwd, /etc/group, /etc/shadow, and so directories). In large environments with many users, it is recommended to use external authentication schemes like LDAP. In our case, with our limited number of users, we will be using local authentication.

We will be creating SSH keys between the two Linux servers that Unison will utilize to establish SSH sessions. A good guide can be found here

Next, we will create a simple command that replicates the content of the directories, along with attributes like permissions and ownership.

After we have a solid synchronization running, we will then want to create duplicates of the Samba share configurations so that the shares are available independent of what server we connect to.

The DNS configuration is optional, but it will allow us to be able to type one hostname and connect to either server.


This software should be installed on your servers before you begin the configuration process. Samba Unison An SSH Server (check your specific distribution's manual for more information) Bind 9 (optional)


User Synchronization

SSH Keys

Unison Configuration

Crontab Configuration

Samba Shares

DNS Configuration (Optional)