This article is from a FAQ concerning SCO operating
systems. While some of the information may be applicable to any OS,
or any Unix or Linux OS, it may be specific to SCO Xenix, Open
Desktop or Openserver.
There is lots of Linux, Mac OS X and general Unix info elsewhere on
this site: Search this site is the best
way to find anything.
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?".
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 2 | 27 | 38 | 38 | 3,579 |
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Click here to add your comments