If the SCO passwd file has the encrypted password in its second field (in other words, the system isn't using /etc/shadow), then this simple script will work:
IFS=":" cat scopasswdfile | while read line do set $line useradd -c $5 -p $2 -s /bin/bash -d /home/$1 -m $1 done
This requires a current version of "useradd"; the older versions don't take encrypted passwords with -p
Normally, however, the encrypted passwords will be in /etc/shadow. This needs a little more work:
sort scopasswd > /tmp/p1 sort scoshadow > /tmp/p2 join -t: /tmp/p1 /tmp/p2 > /tmp/pscopass IFS=":" cat /tmp/pscopass | while read line do set $line useradd -c $5 -p $8 -s /bin/bash -d /home/$1 -m $1 done
Note that only the first 13 characters in the non-shadow passwd file are the encrypted password; the rest (stuff after the comma) is for password aging: see "man F passwd".
J.P. Radley abserved: "it be easier to ditch the shadow file and reconstruct it, by running pwunconv, grabbing a copy of /etc/passwd, then running pwconv?".
If converting from SCO to Linux and you desire to retain user id's, you need to be aware of these files.
For SCO, it's etc/default/accounts and etc/default/authsh.
On Linux, the file is /etc/login.defs:
# # Min/max values for automatic uid selection in useradd # UID_MIN 1000 UID_MAX 60000 # System accounts #SYS_UID_MIN 100 #SYS_UID_MAX 999 # # Min/max values for automatic gid selection in groupadd # GID_MIN 1000 GID_MAX 60000 # System accounts #SYS_GID_MIN 100 #SYS_GID_MAX 999
There are many options in there that are not comonly set; you should review what you can control there.
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Increase ad revenue 50-250% with Ezoic