1830906 Members
2629 Online
110017 Solutions
New Discussion

Move user profile

 
SOLVED
Go to solution
juno2
Super Advisor

Move user profile

I will change the hp ux server to linux server , what is the best way to move the user profile ( /etc/passwd , /etc/shadow etc ) ? thx.
14 REPLIES 14
Michael Tully
Honored Contributor
Solution

Re: Move user profile

If the system is not trusted, then you just move the users contents from the /etc/passwd file. (Remove of course root and other system required accounts) There is no /etc/shadow on a HPUX server even if it is trusted. If your system is trusted, you'll have to untrust it first, as linux does not have a similar file structure.

# /usr/lbin/tsconvert -r (to un-trust a system)

Don't forget to backup user home directories as well if needed. You will find that the ~users/.profile will have different definitions on linux.
Anyone for a Mutiny ?
Steven E. Protter
Exalted Contributor

Re: Move user profile

The user profile itself in a standard HP-UX installed is in the home directory.

It is a file called .profile

In Linux the file is called

.bash_profile

You can copy the .profile file, rename it and then run tests to make sure everything works as expected.

There are a few other files which I've not seen in HP-UX.

.bash_logout

These are the commands you want to run when the user logs out. The standard Linux profile has one command, clear

This of course can be enhanced to clean up user processes.

The equivalent of the .sh_history file is .bash_history. Don't migrate it, it won't be of much help.

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
Rajeev  Shukla
Honored Contributor

Re: Move user profile

Hi,

One way is to extract the fields from /etc/passwd file in HPUX and create those users in linux server. Or alternatevely as Michel said, copy the /etc/passwd /tmp/passwd.dev
vi /tmp/passwd.dev and cut the top few lines reserved for system i guess till "www" and append this file to the /etc/passwd in linux

Also make sure before you do this the HPUX server should be untrusted otherwise you'll have * in passwd fileds.

Rajeev
twang
Honored Contributor

Re: Move user profile

I have used the following procedure for moving user from hpux to linux:
1. In the HP-UX(if the hpux is not truested):
cut -d: -f1,2 /etc/passwd > /tmp/hpuxuser.lst

2. Copy hpuxuser.lst to the linux box's /tmp.

3. Create a 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)

}' /tmp/hpuxuser.lst

4. run the script.
juno2
Super Advisor

Re: Move user profile

thx all reply,

I want to further to ask Tully's method, when run tsconvert , it pop up the error, what is wrong in my system ? thx

# /usr/lbin/tsconvert -r
System is not Trusted System.
Deleting at and crontab audit ID files...
Can't open directory: /var/spool/cron/.ataids
twang
Honored Contributor

Re: Move user profile

To restore password functionality, do you try to run tsconvert in single user mode, if no, try to return system to single user mode, then
run "tsconvert -r" which removes trusted system
You should remove asterisk in password field of /etc/passwd, that will reactivate passwords.

juno2
Super Advisor

Re: Move user profile

Thx all,

It is HP UX non-trusted system now , Is there any tools that can directly mv the user profile from UX to linux ? thx
Ravi_8
Honored Contributor

Re: Move user profile

Hi,

No tool exist to move users from hp-ux to linux,
either you have to use twang's method to move or create the users on linux.

i prefer creating the users insteading of moving
never give up
juno2
Super Advisor

Re: Move user profile

Thx reply , but there are about 500 users in our system , creating all users profile one by one is not a suitable way I think, I remember that there is a command that can output all the user profile to a file , then copy this file to linux and extract it and overwrite the existing linux user profile , is there similiar unix function to do that? thx.
juno2
Super Advisor

Re: Move user profile

Hi all ,

Is it no such utility in unix system ?
juno2
Super Advisor

Re: Move user profile

thx twang ,

I have tested r method, but how can i preserve the group , user's home directory ?

Thx
Steven E. Protter
Exalted Contributor

Re: Move user profile

You ask:
It is HP UX non-trusted system now , Is there any tools that can directly mv the user profile from UX to linux ?

Answer

ftp
scp
rcp

Any will do.

As far as preserving groups and such here is a method.

Check what the users group entries were on HP-UX.
Make sure the same group entries are now in /etc/group

Manually change the user id in /etc/passwd to match the user id from the HP-UX system.

Unix users start with user id 500

If this becomes complex. merely tar up the user files, or scp them across and use this command to change ownerhip and group after the fact.

cd /home/username

chown -R sag:users *

The process can be partially automated, but some eyeball time is required.

SEP
Call me anything you want, but don't forget the points.
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
Ivajlo Yanakiev
Respected Contributor

Re: Move user profile

Yes Linux is Unix but for me
if you have not many user just use useradd to recreate users. And replace only password.
Or you can force your users to change password next time they log in
juno2
Super Advisor

Re: Move user profile

Thx all reply ,

I have tried twang's method , it is work fine , but still have problem , eg , if the user is no password , then the system will not create the login id , secondly , the script will create the user path to /home , it will not preserve the original user path , it make use some time to maintain totally 500 users in our system.
Although this is a good method , is there any other method to convert the user profile ( including password , user group , path ) to new system ? thx in advance.