Operating System - HP-UX
1829749 Members
1671 Online
109992 Solutions
New Discussion

Re: User account and password migration

 
SOLVED
Go to solution
Chris Fung
Frequent Advisor

User account and password migration

Hi,

Just wondering whether the user account and password can be migrated from one HP machine to another?

Thanks for help,
11 REPLIES 11
Scott Van Kalken
Esteemed Contributor

Re: User account and password migration

The easiest way I can think of to do this is the write a script that extracts username, home dir, groups etc from the current system, then write another one to create them on the new system.

Sridhar Bhaskarla
Honored Contributor
Solution

Re: User account and password migration

Hi Chris,

If the other system is a brand new HP machine, you don't have to worry about copying the individual accounts.

1. Copy /etc/passwd into /tmp on the first system.
2. Edit /tmp/passwd and remove all the default entries like root,sys,adm etc. Save the file. This has all the user entries.
3. Ftp this file to the other system. Append the file to /etc/passwd after taking a backup.
4. Repeat the above procedure for /etc/group.
5. Home directories are little bit tricky. This is the reason we don't create home directories in different locations. If everything is under /home or /users, then tar up the the root (/home or /users) directory and untar them in the other system.
If they are under different locations, then use awk to get the home directories and then tar them up.

Hope this helps.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Uday_S_Ankolekar
Honored Contributor

Re: User account and password migration

Hi,
If you can make use of .rhosts follow these steps

1.From box1# find /home | cpio -o | remsh newbox '(cd /; cpio -ivmud)'
2.box1# find /tcb/files/auth | cpio -o | remsh newbox '(cd /; cpio -ivmud)' (If you are trusted)
3. box1# rcp /etc/passwd newbox:/etc/passwd
4. box1# rcp /etc/group newbox:/etc/group

This would work only when you open remsh,rcp between two boxes. This can be done by .rhosts entry.

Make sure that you have a copy of password files and group files before doing this.
Also keep open couple root login session on both the servers. Incase if you loose password by any reason this session would help!!

Goodluck
-USA..
Good Luck..
Michael Tully
Honored Contributor

Re: User account and password migration

Hi,

If you have a trusted system you will need to add the /tcb directory to the list of files/directories to be copied. Without this you will only have half of your user information.

HTH
-Michael
Anyone for a Mutiny ?
Kenny Chau
Trusted Contributor

Re: User account and password migration

Hi Chris,

Yes, you can migrate the user account from one server to another server. Just simply copy the users account in /etc/passwd and paste to the other server's /etc/passwd and copy users' home directory to the other server and that's all.

eg.
grep XXXXX /etc/passwd > /tmp/account1
rcp /tmp/account1 node2:/tmp
In node2, cat /etc/passwd /tmp/account1 > /tmp/passwd
cp /tmp/passwd /etc/passwd
In node1, rcp related home directory to node2.
In node2, login XXXXX as usual.

Hope this helps.
Kenny.
Kenny
Steven Sim Kok Leong
Honored Contributor

Re: User account and password migration

Hi,

In addition to all the directories and files mentioned above, don't forget to copy the following across to the new machine in a full migration:

1) user mail boxes
- /var/mail/*

2) at and cron jobs
- /var/spool/cron/atjobs
- /var/spool/cron/crontabs

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Chris Fung
Frequent Advisor

Re: User account and password migration

Hey guys,

Thanks for your advices!! What if the source system is running tcb? And the users would like to retain their old password in the new system?

Thanks,
xujun
Advisor

Re: User account and password migration


You can try to change /etc/passwd and /etc/group according to Sridhar Bhaskarla , while after this ,you needn't create or copy their home direcories if you use nfs on the new one machine.
Firstly, create /etc/exports ,add a line as :/home -anon=65534
/home is home directory of users
secondly, change /etc/rc.config.d/nfsconf file,
assurring NFS_SERVER=1
then reboot
thirdly, on client, just the new one machine, adding a line in /etc/auto_master
/home /etc/auto.home
the create /etc/auto.home as following:
/home -rw -intr server:/home
"server" is the hostname of original machine.


Best Regards!
Steven Sim Kok Leong
Honored Contributor

Re: User account and password migration

Hi,

Did you missed Uday S. Ankolekar's response? He has given you one method of copying /tcb over.

For my migrations, I usually just tar /tcb on the source system, scp (for security over rcp) them over to the new system and untar them.

Don't forget that /etc/passwd and /etc/group still needs to be copied over as well, also indicated by above responses.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Steven Sim Kok Leong
Honored Contributor

Re: User account and password migration

Hi,

To further clarify, files in /tcb/auth/files/X/XXXXX contains the encrypted passwords for each user account, thus copying /tcb over in a trusted system will migrate the passwords over.

Just a note. Before you copy the /tcb over to your new system, please tsconvert it to trusted first. Using sam will be more straightforward.

Hope this helps. Regards.
Steven Sim Kok Leong
Honored Contributor

Re: User account and password migration

Hi,

To further clarify, files in /tcb/auth/files/X/XXXXX contains the encrypted passwords for each user account, thus copying /tcb over in a trusted system will migrate the passwords over.

Just a note. Before you copy the /tcb over to your new system, please tsconvert it to trusted first. Using sam will be more straightforward.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com