Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > AS/ES/WS v. 3 > Issue <<  105 of 593 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 4565
Last update: 10-06-06
Issue:
How do I migrate user accounts from Red Hat Enterprise Linux 2.1 to version 3 or 4?
Resolution:

Migrating user accounts is not an easy task. You would have to make sure that file ownerships remain intact and passwords and group memberships remain the same. Files to consider would be, for example, their home directories and emails.

The good thing with Red Hat Enterprise Linux 2.1 and 3 is that they have similarities with the way they handle user accounts. Users that are added to the system always start with UID and GID values of 500 and up unless overriden (see man page for useradd). Here, we are assuming that you are using /etc/passwd, /etc/group and /etc/shadow for authentication. Migrating then, is a matter of importing user accounts with UID >= 500.

In order for this procedure to work properly, you should not create any new user accounts on the newly installed Red Hat Enterprise Linux 3 system. The process below involves taking your user accounts and appending them to existing system accounts in the appropriate files. This procedure is only valid for post installation and we recommend that you back up any files that you will be appending user account information to.

On the Red Hat Enterprise Linux 2.1 system:

 
 # awk -F: '($3>=500) && ($3!=65534)' /etc/passwd > passwd.txt 
 # awk -F: '($3>=500) && ($3!=65534)' /etc/group > group.txt
 # awk -F: '($3>=500) && ($3!=65534) {print $1}'
       /etc/passwd|tee -|egrep -f - /etc/shadow > shadow.txt    
 # tar czpf home.tgz /home
 # tar czpf mail.tgz /var/spool/mail  
	  

Copy the files passwd.txt, group.txt, shadow.txt, home.tgz, and mail.tgz and put them in, say, /backup on the Red Hat Enterprise Linux 3 system then do the following:

 
 # cd /
 # cp /etc/passwd /backup/passwd-backup.txt
 # cat /backup/passwd.txt >> /etc/passwd
 # cp /etc/group /backup/group-backup.txt
 # cat /backup/group.txt >> /etc/group
 # cp /etc/shadow /backup/shadow-backup.txt    
 # cat /backup/shadow.txt >> /etc/shadow    
 # tar zxf /backup/home.tgz    
 # tar zxf /backup/mail.tgz
		


Note: You may want to untar the /home (home.tgz) and /var/spool/mail (mail.tgz) directories in a temporary directory first and then move them to /home and /var/spool/mail.

Check if the migration was successful by logging into the system using one of the migrated user's account.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > AS/ES/WS v. 3 > Issue <<   105  of  593  >>