Difference between revisions of "Directory Replication"

From SambaWiki
(Beginnings of the tutorial)
 
Line 14: Line 14:
 
==Prerequisites==
 
==Prerequisites==
 
This software should be installed on your servers before you begin the configuration process.
 
This software should be installed on your servers before you begin the configuration process.
  +
 
Samba
 
Samba
  +
Unison
 
  +
Unison (Most distributions include a precompiled version. The source code can be found [http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/ here]
  +
 
An SSH Server (check your specific distribution's manual for more information)
 
An SSH Server (check your specific distribution's manual for more information)
  +
Bind 9 (optional)
 
  +
Bind 9 (optional) (Most distributions include a precompiled version. The source code can be found [https://www.isc.org/software/bind here]
   
 
==Setup==
 
==Setup==
  +
We will now begin the setup the setup.
   
 
===User Synchronization===
 
===User Synchronization===
  +
'''This step can be skipped if you want the synchronized files and folder to inherit the owner and group permissions of the account that initializes the synchronization.In most cases, though, you will want the permissions and attributes to sync as well.'''
  +
As mentioned earlier, in environments with many users and groups, an LDAP backup is a good choice to synchronize the users between the Linux servers, in this tutorial, we will be manually synchronizing the UIDs and GIDs of the users and groups that utilize the file servers.
  +
  +
On both Linux servers, open up the files /etc/passwd and /etc/group so that we can see the UIDs and GIDs. Note the users that will be utilizing the file server. We are not referring to automatically created user accounts that manage programs that are created during installation, but we are referring to user accounts made later for specific users.
   
 
===SSH Keys===
 
===SSH Keys===

Revision as of 03:25, 15 January 2013

Introduction

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.

Prerequisites

This software should be installed on your servers before you begin the configuration process.

Samba

Unison (Most distributions include a precompiled version. The source code can be found here

An SSH Server (check your specific distribution's manual for more information)

Bind 9 (optional) (Most distributions include a precompiled version. The source code can be found here

Setup

We will now begin the setup the setup.

User Synchronization

This step can be skipped if you want the synchronized files and folder to inherit the owner and group permissions of the account that initializes the synchronization.In most cases, though, you will want the permissions and attributes to sync as well. As mentioned earlier, in environments with many users and groups, an LDAP backup is a good choice to synchronize the users between the Linux servers, in this tutorial, we will be manually synchronizing the UIDs and GIDs of the users and groups that utilize the file servers.

On both Linux servers, open up the files /etc/passwd and /etc/group so that we can see the UIDs and GIDs. Note the users that will be utilizing the file server. We are not referring to automatically created user accounts that manage programs that are created during installation, but we are referring to user accounts made later for specific users.

SSH Keys

Unison Configuration

Crontab Configuration

Samba Shares

DNS Configuration (Optional)