Problem
My /etc/passwd file is missing or corrupted, and I have no backups.
My server is not able to boot correctly and I have no way to boot the server.
Is there a way to re-create it from the user information in the /tcb directories?
Cause
Potentially lots of things can cause this issue but certainly running 'useradd' when there's no root disk space available is one candidate.
Solution
If you are not able to boot your server then use Emergency Floppies to boot the server and mount the hard disk or supported customers should contact SCO Support for assistance.
For all SCO Unix Release:See: pwconv(ADM) pwunconv(ADM)The same script, below, could also be modified for extration to/from /etc/shadow.
For UnixWare7, see also TA 110176For OpenServer6/5 Only:The following shell script may work:#clip here
:
touch /etc/passwd
cd /tcb/files/auth/
for i in `find . -type f -print`
do
NAME=`basename $i`
echo "$NAME:x:`head -1 $i | cut -f 2 -d "#" | cut -f 1 -d
":"`:50::/usr/$NAME:/bin/sh" >> /etc/passwd
done
#clip hereNOTE: There is a combination of " (double-quotes) and ` (back-ticks) in
the script. Be careful to note the difference.You may need to customize this script if you are using a security level of "low", if your users are in a group other than gid "50", or in other circumstances.
Make sure you run "/tcb/bin/authck -av" after running this script; note and repair any discrepancies detected.
Although this procedure has been known to work for some users, this shell script is not a guaranteed method for recovering the /etc/passwd file. Having reliable, current backups and an experienced System Administrator is more likely to help.
See also
man pages passwd(F), shadow(F), group(F), authck(ADM)