Migrating etc password file from Red Hat 9 to Enterprise

We need to know if there is a way or tool to migrate the etc password file from 9 to enterprise. This is an extremely URGENT issue, so if you could respond quickly it would be greatly appreciated. Please let me know if you need more information.. As I am a novice to Linux.. Thanks in advance!!

Who is Participating?
OzzModConnect With a Mentor Commented:
Closed, 500 points refunded.
Community Support Moderator (Graveyard shift)
I don't have the specifics for Enterprise's peculiarities, but the same kind of password file
ought to work on both systems, unless one has customized it.

But if you want to Migrate  /etc/passwd over
you will also need to migrate over   /etc/shadow

And possibly

To move users' group ids over as well

/etc/passwd   is the file that should be publicly readable (by all users of the system)
and just contains the user database  for use by the basic commands

/etc/shadow     is the file that contains actual matching passwords for all the users,
and should be readable only by root.

The format for the files is fairly typical, though the encryption methods/settings may differ
between releases or systems

Try  /etc/libuser.conf    for settings details
if both systems have it, and/or they both have the same cryptstyle,
then the password configuration should be basically interchangeable,
I think.. so long as all the password files make it over in the migration
If you haven't changed any defaults, you can simply copy across


Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.


   Before you copy over those 3 files which other experts suggested, please make a copy of them.
cp /etc/passwd /etc/passwd.original
cp /etc/shadow /etc/shadow.original
cp /etc/group /etc/group.original

   After copying over those files, compare
/etc/passwd amd /etc/passwd.orig
and check for the system account with user account, make sure the old user account in /etc/passwd doesn't have the
same UID as the new system/service account in /etc/passwd.orig.
It yes, then change the UID of system account or user account.
onsite_techAuthor Commented:
we ended up finding a redhat "unoffical" migration script that snagged all of the users and thier home dirs and threw them into a tar file.  that worked great (if a bit slow) and we migrated it over to the new server, but now we have a problem cause the tar file is 5 gigabytes and every time we try to do anything with it (view the files in it or extract it) it just kinda sits there and doesn't really do anything (the process load on the box doesn't go up, it just sits there).

anyone have any ideas on how to handle files this big and untarring them?
Could you post the URL of the migration script, which you downloaded?
You might need to modify the script for the tar to archive into separate small tar.gz files.
What happens when you do:

strace tar ztvf tarfile.tgz

onsite_techAuthor Commented:
i'm having a hard time finding the actual page on redhat's site but here is the script itself:

# * by Chris Kloiber <ckloiber@redhat.com>
# Quick and dirty hack to migrate user and group data from a sick
# machine to a new machine. This script is provided "AS-IS", and is
# licenced to you under the GPL, which as always can be downloaded
# from http://www.gnu.org/copyleft/gpl.html
# Although I work for Red Hat, Inc. this script is not a product
# of Red Hat, Inc. It has not been through QA other than my own
# testing. It might eat your data, but it didn't eat mine. YMMV.

if [ $CUSTOMIZED = 'no' ]; then
        echo "Take a moment to edit this script to customize it";
        echo "for your particular environment. Edit this script";
        echo "and change the CUSTOMIZED variable to 'yes' to";
        echo "bypass this message.";
        exit 0;

# This backup uses 'tar', you get to choose the compression.
# You can specify a /location/filename for the tar.

# Leave off the file extention. It will be added based on COMPRESSION
# BACKUP_PATH=/mnt/dist/
# BACKUP_FILE=$(hostname)-$(date -I)
BACKUP_FILE=$(hostname)-$(date -I)

# If you set TAPE_DEVICE, BACKUP_PATH and BACKUP_FILE are ignored.
# If you don't have a tape drive, leave this blank. (tapes not tested)

# The choices for compression are: bzip2, gzip or none

# Be clean (or not, this script is for dying machines afterall)

# Paths to home and mail, relative to / (but don't include the /)

# Other variables that should not need changing often, if at all.

# Here we parse the group, passwd, and shadow files.
# We do *not* write to the original files, but instead create *.sav files
# (this part took me several hours to figure out...)

awk -F ":" -- '{if ($3>='499' && $3!='65534') print}' $GROUP > $GROUP.sav
awk -F ":" -- '{if ($3>='499' && $3!='65534') print}' $PASSWD > $PASSWD.sav

for i in $(awk -F ":" -- '{print $1}' $PASSWD.sav) ; do
        awk -v user=$i -F ":" -- '{if ($1==user) print}' $SHADOW >> $SHADOW.sav;
        echo $i >> $USERS

# Now we have tossed out the system accounts, and have pure user data.
# It's time to grab the home and mail directories. I will build a list
# of directories to back up, then use it to make a tarfile.

echo $GROUP.sav > $BLIST
echo $PASSWD.sav >> $BLIST
echo $SHADOW.sav >> $BLIST

for i in $(cat $USERS) ; do
        echo $HOMEDIR/$i >> $BLIST ;
        echo $MAILDIR/$i >> $BLIST ;

# Actually make the archive

cd /
if [ $TAPE_DEVICE ]; then
        if [ $COMPRESSION = 'bzip2' ]; then
                tar -T $BLIST -jcvf $TAPE_DEVICE ;
        elif [ $COMPRESSION = 'gzip' ]; then
                tar -T $BLIST -zcvf $TAPE_DEVICE ;
                tar -T $BLIST -cvf $TAPE_DEVICE ;
        if [ $COMPRESSION = 'bzip2' ]; then
                tar -T $BLIST -jcvf $BACKUP_PATH/$BACKUP_FILE.tar.bz2 ;
        elif [ $COMPRESSION = 'gzip' ]; then
                tar -T $BLIST -zcvf $BACKUP_PATH/$BACKUP_FILE.tar.gz ;
                tar -T $BLIST -cvf $BACKUP_PATH/$BACKUP_FILE.tar ;
        fi ;

# cleanup temporary files
if [ $CLEANUP = 'yes' ]; then
        rm -f $GROUP.sav $PASSWD.sav $SHADOW.sav $USERS $BLIST

echo ""
echo "You are done on this end. (Yay!)"
echo ""
echo "When you have extracted the archive on the target machine there is"
echo "still some work to be done. You will need to add the user information"
echo "found in the /etc/*.sav files to the end of the new system's"
echo "/etc/group, /etc/passwd and /etc/shadow files. You must do this while"
echo "making sure there is no overlap of uid or gid numbers. This will"
echo "usually happen for uid=500 if you created a user account on the new"
echo "machine during install. Just be aware of it, it's not hard to fix."
> for i in $(cat $USERS) ; do
>         echo $HOMEDIR/$i >> $BLIST ;
>         echo $MAILDIR/$i >> $BLIST ;
> done
Comment out this portion and move over the home direcotry and mail folder manually.

In this script, it assumes all the home directories are under /home
and all the unread mails are under /var/spool/mail
onsite_techAuthor Commented:
I figured out why the tar file wasn't working correctly.  the partitions on this box were loaded weird and the disk i was extracting it to didn't have enough space.  it works fine now though.  pretty cool script.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.