How can I transfer SCO accounts (passwd information) to Linux?

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?".

maximum uid

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

->
-> How can I transfer SCO Unix accounts (passwd information) to Linux?

2 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence







Tue May 3 19:14:38 2005: 434   anonymous


do we need to decode the password? thanks



Tue May 3 19:41:40 2005: 435   TonyLawrence

gravatar
No. The script should work as is.



------------------------
Kerio Samepage


Have you tried Searching this 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.

Contact us

privacy policy