Link to home
Start Free TrialLog in
Avatar of mnis2008
mnis2008

asked on

Copy Users/groups

Hello I have 2 linux servers, csclpv012 and cdclpv014. I want to copy all the users from csclpv012 to csclpv014. Here is what I am thinking of
Copy /etc/passwd
Copy /etc/groups
Copy Home directories
Copy /etc/shadow
So by doing this will I be able to copy users and user credentials to another linux machine...



ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'd recommend against the copy unless the server to which this information is being copied was just built.

Any consideration setting up a centrally managed user/password i.e. OpenLDAP?

Care must be taken when combining already running servers as a change in UID/GID could adversely affect the functionality of some applications.
Since all file access are UID/GID based only the home directory of the account whose UID/GID changed will see the update not all the instances of directories/files where this account might be storing information/logs, etc..

I agree with Arnold.

If you want to centralize user accounts passwords, go for ldap or if you need a very quick and dirty in a totally secure lan, you may also go for NIS which is extremely easy to implement unlike LDAP.

Furthermore, you can centralize user accounts through NFS mounts.  This way, there will be only one centralized location and user accounts will be consistent.  If you have only two machines, you can export /home via NFS and mount it on the second computer
Avatar of mnis2008
mnis2008

ASKER

Yes the new server is just built and we want to have UID/GID for all the users same. I have like 100 accounts on the old server so I planned to copy the important files.

All this users have all there stuff set up in there home directories. I guess I need to rysnc the directories too...
Any thoughts against NFS mount?
Usually accounts are >1000 for users

awk -F: ' ($3>=1000) { print  } ' | ssh root@cdclpv014 'cat - \>\> /tmp/passwd'
Then you would merge the /tmp/passwd into /etc/passwd.
vipw  
shift+G to get to the end, :r /tmp/passwd.

You would need to use rsync to sync the home directories.
You might want to consider looking into the Andrew File system (AFS)

If a single shared storage as an NFS mount as farzanj pointed out is not an option.
rsync can be used, but you have to be careful since usera can login into either system and add or remove files.
Here is a pretty good article that also describes the steps to take with different distros:

http://www.cyberciti.biz/faq/howto-move-migrate-user-accounts-old-to-new-server/