1827465 Members
4417 Online
109965 Solutions
New Discussion

transfer user

 
Juno
Occasional Advisor

transfer user

We will change my HP UX 10.2 to linux , how can I move the UX users to linux instead of re-creating all the users again ? thx
Juno
13 REPLIES 13
Jerome Henry
Honored Contributor

Re: transfer user

I'm not much familiare with HP UX, but do you have some kind of /etc/password and /etc/shadow ? If it is the case, you could cp them to your Lnx Box...
You can lean only on what resists you...
Francisco J. Soler
Honored Contributor

Re: transfer user

Hi,
You can extract from /etc/passwd the users you need to create, and apply a script to create those users automatically (try with useradd command), the only thing i don't know how can you make it automatically is to assign the old passwords to the new users in linux.

Frank
Linux?. Yes, of course.
John Meissner
Esteemed Contributor

Re: transfer user

Yes - copying the /etc/passwd file will allow you to move users over. You may need to also do at move of the /home/ directories.if you want to back up a list of this and remake them you could do:

ls /home > home.list

and on the new linux box do:

for i in $(cat home.list)
do
mkdir -p $i
done
All paths lead to destiny
Juno
Occasional Advisor

Re: transfer user

is there any command to do that? thx.
Juno
John Meissner
Esteemed Contributor

Re: transfer user

command to do what? copy the /etc/passwd file?

just open an ftp session to your new Linux server and put the /etc/passwd file in your home directory. telnet to the linux box and then just quickly vi (the prefered unix text editor) the file and remove all but the user accounts. save the file and then
su to root and
cat passwd >> /etc/passwd
All paths lead to destiny
Francisco J. Soler
Honored Contributor

Re: transfer user

Hi, Juno, I've tried the following with HP-UX 10.20 and RedHat 7.1, and works fine.

1.- In the HP-UX,:
cut -d: -f1,2 /etc/passwd > /tmp/users.txt

2.- Edit /tmp/users.txt file and keep only the lines which user names you want to transfer to linux.

3.- Copy this modified file to the linux box.

4.- Create the following script:
# Begin script
#!/bin/sh
awk -F: '{
c=sprintf("echo \"/usr/sbin/useradd -p %s %s\"",$2,$1)
system(c)
c=sprintf("/usr/sbin/useradd -p %s %s",$2,$1)
system(c)

}' /path_to_users.txt

# End script

Be careful with the quotation marks.

5.- Execute the script.

You create the HP-UX users into linux box with the same passwords.

Cheers
Frank.
Linux?. Yes, of course.
Steven Lee_11
New Member

Re: transfer user

im currently trying to import users from my redhat 8.0 to redhat es v2.1 .

i tried the script but it seems it created the user but not the password for the user , is there a way to maintain the password of the users ?

if not is there a way to assign the same password to all the imported uses
Steven Lee_11
New Member

Re: transfer user

my system is using MD5 on passwd . is there a way to make it work
Francisco J. Soler
Honored Contributor

Re: transfer user

The problem with the script is that you are using shadow passwords, so the first cut command does not import the password correctly, you must do the same thing with the file /etc/shadow instead of /etc/passwd.

Frank.
Linux?. Yes, of course.
Steven Lee_11
New Member

Re: transfer user

i have run the pwconv to make the passwd file like the normal passwd file u find on unix.

so the password field is there but cant add it to the new system.
Francisco J. Soler
Honored Contributor

Re: transfer user

Hi Steven, in which step are you in trouble?

Frank
Linux?. Yes, of course.
Steven Lee_11
New Member

Re: transfer user

managed to add users sucessfully , but not the password.
Steven E. Protter
Exalted Contributor

Re: transfer user

You'll need the relavent entries in the /etc/passwd file and the /etc/group file.

You'll need to check and see if the same number of columns.

You will need to eliminate them.

I have gotten away with this linux to linux but not hp-ux to linux.

You may need to reset the passwords on those users after the transfer.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com