How to migrate all users to an new server

My file server which is running Linux Ubuntu 12.01, contains more than 30 users and its samba user accounts. Now I have an brand new machine, and want move all those user accounts from the old machine to the new one without re-creating all user accounts in the new machine.

Does anyone know how to do moving user account to a new machine please?


I found the way to migrate all unix accounts, samba accounts and configuration from the old samba file server to new one. It is simple, justcopy the following files from the old filer server, then replace at the new file server:

/etc/passwd (User name and account info)
/etc/shadow (Passwords)
/etc/group (Group names and membership)
/etc/gshadow - Contains group encrypted passwords.
/etc/samba/*
/var/lib/samba/*

After copying completion, restart the following services

service smbd restart
service nmbd restart

Then all users login to new file server and share the files