LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 08-28-2003, 08:56 AM   #1
glt
Member
 
Registered: Aug 2003
Distribution: RedHat
Posts: 39

Rep: Reputation: 15
Question How to copy user accounts between servers


Hi All,

My first post - try to be kind!

I have two RedHat servers:
Old server: RedHat 8.?, kernel: 2.4.18-26.8.0
New Server: RedHat 9, kernel: 2.4.20-20.9

The new server will be a replacement E-mail server for the old one.
My question: what is the most efficient way to copy all of the user
accounts (there are lots) from the old server to the new one?

TIA,
Geoff
 
Old 08-28-2003, 09:07 AM   #2
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 464

Rep: Reputation: 52
1) rsync the user home directories to new computer.
2) merge in the old /etc/passwd and /etc/shadow into the new

If you have special setup for permissions such as in /etc/group or /etc/sudoers, these too will have to be merged.

Presumably you have not setup any new users on the new server which may conflict namewise or UIDwise from those on the old server.

Chris
 
Old 08-28-2003, 09:21 AM   #3
glt
Member
 
Registered: Aug 2003
Distribution: RedHat
Posts: 39

Original Poster
Rep: Reputation: 15
Hi Chris,
Thanks for the reply. I already tared up and pulled over the home directories.
There are no new users on the new server - it is a virgin machine.

It is /etc/passwd and /etc/shadow I was worried about. Exactly how do I merge them?
Could I just replace the copies on the new server with those from the old? Seems too easy!

Cheers,
Geoff.
 
Old 08-28-2003, 02:05 PM   #4
windowsrefund
Red Hat Ambassador
 
Registered: Aug 2003
Location: NYC
Distribution: Debian, Redhat
Posts: 73

Rep: Reputation: 15
Linux rules
 
Old 08-28-2003, 03:04 PM   #5
kjcole
Red Hat Ambassador
 
Registered: Aug 2003
Location: Washington, DC
Distribution: Red Hat 9, Debian
Posts: 16

Rep: Reputation: 0
Since you said it's replacing an e-mail server, you will probably also want to copy over /var/spool/mail/ (unless your incoming mail ends up somewhere else).
 
Old 08-28-2003, 03:39 PM   #6
glt
Member
 
Registered: Aug 2003
Distribution: RedHat
Posts: 39

Original Poster
Rep: Reputation: 15
Hi kjcole,
I already copied over /var/spool/mail too.

Still need to know though:
can I just copy /etc/passwd and /etc/shadow from the old server to the new one?

Cheers,
Geoff.
 
Old 08-28-2003, 03:45 PM   #7
kjcole
Red Hat Ambassador
 
Registered: Aug 2003
Location: Washington, DC
Distribution: Red Hat 9, Debian
Posts: 16

Rep: Reputation: 0
The thing to worry about when copying over the old /etc/passwd and /etc/shadow (and don't forget /etc/group) is that newer versions of packages sometimes need new user/group info. The installation will create those for you, but if you copy your old /etc/passwd et al, you'll wipe out any changes that specific packages have added or changed... Hence, the recommendation to merge rather than overwrite.

You could just append your old to your new, and sort them. Then edit out the duplicates...
 
Old 08-31-2003, 01:39 PM   #8
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 464

Rep: Reputation: 52
Sorry I have not gotten back to this post, but I think kjcole explains it well. But to throw in my 2 cents which may help if you are not finished yet, here goes:

These are simply ascii files. In the best case situation as kjcole says, you could simply replace the files and yes it is just that simple, but to repeat, a new version has likely changed/added system users and groups. In order to merge, you simply add the lines you need from the old files into the new files. Appending and sorting will work, but should a difference exist for the same user or group, I'ld probably take the new one, just because. The only other caveat that comes to me at the moment is potential encription methods for the password in /etc/shadow. There are different methods out there in the wild and I do not know for a fact that RH9 and RH8 use the same method -- but here I am just being a worrywart.

Let us know how it went.
 
Old 09-02-2003, 12:22 PM   #9
kjcole
Red Hat Ambassador
 
Registered: Aug 2003
Location: Washington, DC
Distribution: Red Hat 9, Debian
Posts: 16

Rep: Reputation: 0
Regarding the previous post by fsbooks...

Oops. Right. If you get two lines which are ALMOST duplicates, and you sort the file, you won't necessarily be able to readily identify which line is the newest line, without going back to the original files. While my earlier recommendation is relatively quick, it's not without pitfalls.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User Accounts Kemik Linux - Newbie 13 01-12-2005 04:24 PM
Evolution multiple accounts - servers BUG? tipaul Linux - Software 3 02-04-2004 05:58 AM
Copy User Accounts from Redhat 7.2 to Redhat 9.0 namradi Red Hat 3 11-14-2003 03:28 AM
copy user accounts to other linux system pangfai Linux - Security 2 08-29-2003 04:50 AM
Copy Installed Woody to other 10 servers? osgaldo Debian 3 07-12-2003 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration