Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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!
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).
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...
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.