From http://pcunix.com/SCOFAQ/scotec1.html#ilinuxpass :
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".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.