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...



mnis2008Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

farzanjCommented:
You will have to see if there basic services on both the machines are the same.  If basic system accounts are exactly the same the you need to issue the following command to do this

tar Ppcvf files.tar /etc/passwd /etc/groups /etc/shadow


Then you will transfer it by a method of your choice and then issue only one single command

tar Ppxvf files.tar

But if the system accounts and setup of the two computers different, you have to only copy the  related portions and then append those portions to the respective files.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arnoldCommented:
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..

0
farzanjCommented:
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
0
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

mnis2008Author Commented:
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...
0
farzanjCommented:
Any thoughts against NFS mount?
0
arnoldCommented:
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.
0
AriMcCommented:
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/
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.