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?".
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them.
I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
/SCOFAQ/FAQ_scotec1ilinuxpass.html copyright 1997-2003 (various) All Rights Reserved
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.
Tue May 3 19:14:38 2005: Subject: about transfer unix accounts (passwd info) to Linux anonymous
do we need to decode the password? thanks
Tue May 3 19:41:40 2005: Subject: TonyLawrence
No. The script should work as is.
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar