Wednesday, December 16, 2009

Using AWK to convert UNIX passwords from HP-UX to Solaris

Converting password hashes from HP-UX 11.11 to Solaris is pretty simple if you are using UNIX crypt passwords (if HP-UX isn't a Trusted System. If it is, it will use bigcrypt passwords, > 8 characters, converting them to Solaris UNIX crypt could be problematic).

Here's the gest of it:

On the HP-UX System, we create a test user:

    # useradd test
    # passwd test
    test

Now we convert the passwd file to generate passwd entries for Solaris:

        * # awk ' BEGIN { FS = ":" } { print $1":x:" $3 ":" $4 "::/export/home/" $1 ":/usr/bin/sh" }' /etc/passwd
        * test:x:107:20::/export/home/test:/usr/bin/sh


And we create the shadow file entries, including the password hash:

        * # awk ' BEGIN { FS = ":" } { print $1":"$2"::::::" }' /etc/passwd
        * test:lsDWJo7M.iAhY::::::

Just add them using /usr/ucb/vipw to the password file, edit the shadow file for consistency and test. Be sure to backup the files and to test using a few users at first.

        * $ su test
        * Password:
        * $ id
        * uid=127(test) gid=120
        * $ whoami
        * test
        * $ echo $HOME
        * /export/home/test
        * $ echo $SHELL
        * /usr/bin/sh

    Mix with some shell scripting and mkdir's and you're set :-). Next time, use LDAP :P.

Posted by cmihai at 10:49 PM 1 comments

1 comment:

  1. I have heard about another microsoft sql database recovery tool. Besides, you can visit my blogs at: http://daspeac.livejournal.com/ or http://daspeac.blogspot.com/ where I’m trying to share my experience with regard to data corruption issues.

    ReplyDelete