Technical article 109437

/etc/passwd is missing or 0-length; can I re-create it from the user information in the tcb directories?

OpenServer 6.0.0OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7UnixWare 7.1.0UnixWare 7.1.1UnixWare 7.1.2UnixWare 7.1.3UnixWare 7.1.4Open UNIX 8

Written · Last revised

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 110176
For 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 here
NOTE:     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)

From the Xinuos technical article database, record 109437. Reproduced with permission. The original is at www.sco.com/ta/109437, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.