interview question and answer

July 15, 2012

Migrating Samba Server and Users in CentOS 6

Migrating Samba Server and Users in CentOS 6

To migrate Samba users from one server to another, we will be needing to migrate the following -

  1. /etc/passwd
  2. /etc/group
  3. /etc/shadow
  4. home directories and shared directories
  5. /etc/samba
  6. /var/lib/samba
We assume that we have two servers: old-server (192.168.10.10) and new-server (192.168.10.20). Some of the commands are need to be run in the old-server and some need to be run in new-server.

Old Server:
Backing up users, groups and passwords



NOTE: Please click here for explanation on what the awk command does.

Time to move the home directories using rsync



IMPORTANT: It is vital to preserve the permissions of the files/directories. Although there are many ways to do this, rsync is the easiest possible way.

NOTE: Shared directories can also be migrated the same as home directories. rsync can take care of it.

New Server:
First, we copy the /root/move directory from the old server to the new server.



IMPORTANT: Please backup you passwd, group and shadow file before the next step.

Then, we merge the *.mig files to the actual passwd, group and shadow files



IMPORTANT: Please make sure to use >> (append) and not > (redirection)

Now, it's time to prepare samba



If samba is up and running, netstat would show it.

This way, a Samba server with all it users can be migrated to a new system. Shutdown the old server and check whether the domain or shared directories can be used.

No comments: