Operating System - HP-UX
1828844 Members
2662 Online
109985 Solutions
New Discussion

Coping user to new Computer

 
SOLVED
Go to solution
Marty Metras
Super Advisor

Coping user to new Computer

We are replacing our HP 9000/K220 HP-UX 10.20 with a HP 9000 "N" Class with HP-UX 11.0

When I go to put the users from the Old box to New box is there an easier way than righting a script to recreate the users. The script would do the same thing we do now when we create just one user. The difference it that I already have there names and other information.

Some one told me I could just copy the /etc/passwd and /etc/group files then copy the Users home Directory. In this case I would still have deal with users rights to there home Directory. The Users do not need any of the data in as their directories as they are captive users and it is only passive information.

What you thing?
Marty
The only thing that always remain the same are the changes.
9 REPLIES 9
Victor BERRIDGE
Honored Contributor
Solution

Re: Coping user to new Computer

Hi,
Copying passwd and group file and users home directories will work - and you will not have to deal with permissions if done properly - at the condition you are not on a trusted box...

All the best

Victor
Sridhar Bhaskarla
Honored Contributor

Re: Coping user to new Computer

Marty,

You can do it in different ways. You can even complicate by writing some scripts and incorporating adduser in it.

The best way is as follows. Copy the password and group files as a whole into N-4000.

on N-4000

#cp /etc/passwd /etc/passwd.orig
#vi passwd.k420
Remove all the default entries. Or the
entries that match the passwd file of N4000.
Once they are made sure and removed, save the file
#cat passwd.k420>> /etc/passwd
Do the same thing for group file.

Now take the saved passwd.k420 file and do this

awk '{FS=":";print $1}' passwd.k420 > user.list

Copy this list to K420
on K420 do
#for USER in user.list
>do
>grep "^$USER" /etc/passwd |awk '{FS=":":print $6}' >> home.list
>done

#tar cvf /tmp/home.tar `cat home.list`
Copy /tmp/home.tar into your N-4000 and untar
on N-4000
#tar xvf home.tar

This should copy the home directories.

Now your users can login as it it was the old K420.

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

Re: Coping user to new Computer

Marty,

You can do it in different ways. You can even complicate by writing some scripts and incorporating adduser in it.

The best way is as follows. Copy the password and group files as a whole into N-4000.

on N-4000

#cp /etc/passwd /etc/passwd.orig
#vi passwd.k420
Remove all the default entries. Or the
entries that match the passwd file of N4000.
Once they are made sure and removed, save the file
#cat passwd.k420>> /etc/passwd
Do the same thing for group file.

Now take the saved passwd.k420 file and do this

awk '{FS=":";print $1}' passwd.k420 > user.list

Copy this list to K420
on K420 do
#for USER in user.list
>do
>grep "^$USER" /etc/passwd |awk '{FS=":":print $6}' >> home.list
>done

#tar cvf /tmp/home.tar `cat home.list`
Copy /tmp/home.tar into your N-4000 and untar
on N-4000
#tar xvf home.tar

This should copy the home directories.

Now your users can login as if it was the old K420.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Marty Metras
Super Advisor

Re: Coping user to new Computer

Victor,
The box isn't Trusted. Well not yet.
If I edit the Old passwd and group file then append them to the new box files that should give me the old users/groups on the new box?

How do I get the rights for the users directories?
If I put them on tape and move them will the rights on the directories/files go with them?

What I think I'm asking is the userID has a UID. Are the rights attached to the UID or the UserID(name)?

If I ftp this data from one box to the other how does the Right happen for the User's Directories?

Am I tring to make the harder than it is?
Marty
The only thing that always remain the same are the changes.
Sridhar Bhaskarla
Honored Contributor

Re: Coping user to new Computer

Marty,

Sorry for answering the question on behalf of victor.

The permissions will not change if you untar the home directories and will be set accordingly. As long as you don't change the uids, the permissions will remain intact. If you change the uids in the password files, then the files owned by the corresponding user will be owned by the previous uid number. That is the reason why we just need to append the password files.

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

Re: Coping user to new Computer

Marty,

Most archiving utility have an option to preserve the permissions and timestamp of files in the archive. For tar, the options is -p. This option is a default for superuser.
So when you create and when you restore the user's home file and if you're using tar, use the -p option.

Hope this helps.
Life is what's happening while you're busy making other plans
Jason VanDerMark
Trusted Contributor

Re: Coping user to new Computer

Marty,

My approach many not be as fancy as some, but it works for me, so here goes. FTP the /etc/passwd and /etc/group files to the new server but do not place them into /etc. For this example we will say that you put them into slash[/]. Run vi on /passwd and remove the second columns data(encrypted password) and replace it with a asterisk(*). This will disable all of the accounts. Then save the file. Then copy /etc/passwd to /etc/passwd.orig and copy both the /passwd and /group into /etc. Then at the command line run 'passwd' as root to change the root password. Think of a default password that you can assign for each user, and then execute 'passwd' for any one user (eg. passwd gwells). Then go into the /etc/passwd file and find the user who's passwd you set to the default. You will then want to copy the second column of data(encrypted passwd) from that user(eg XjrZs15A1K42) Then paste that data into the second column of all of your users(not into the special accounts obviously). Doing this should set the passwd for all of your users to the same thing. Then you just email them all to let them know that they can login to the new server with the default passwd and that they need to change their password upon login. Then just keep the string written onto a piece of paper so that you can check back after a while to see who has changed their passwords. Well, I hope that helps.

Regards,
Jason V.
Tie two birds together, eventhough they have four wings, they cannot fly.
Roger Baptiste
Honored Contributor

Re: Coping user to new Computer

Marty,

<>

Yes. When you install the O/S on the New system, default system accounts are created in the password and group file. Except these accounts , you would need to append all the accounts from your old system.
for eg: if your old password file and group file is
/etc/password.OLD
/etc/group.OLD

Edit these two files and remove any entry
which is already there in the new systems
/etc/passwd and /etc/group file.
Then, you just append these files.

<>

Restoring the directories will take care
of this.

<>

Yes!

<>

The rights are attached to the userid.
If you restore the files without creating/copying the user accounts to the new system, the files will have the UID number as the ownership .

<>

FTP is not a good idea, since it doesn't preserve the old permission or ownerships.
You would need to do them manually after FTPing the file. Whereas if you restore, it will be automaticaally be taken care of.

HTH
raj
Take it easy.
T G Manikandan
Honored Contributor

Re: Coping user to new Computer

Hello,
YOu can cp the passwd and group file.
Then you can do a
#rcp -rp :/home/* /home/

I am assuming that your user directories are under /home filesystem.
before you do that make sure that you have a entry in your /.rhosts file of the old server.
#vi /.rhosts
newserveripaddress root

wq!