*BSD News Article 31134


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!EU.net!uknet!lyra.csx.cam.ac.uk!warwick!zaphod.crihan.fr!jussieu.fr!univ-lyon1.fr!ensta!itesec!keltia.frmug.fr.net!not-for-mail
From: roberto@keltia.frmug.fr.net (Ollivier Robert)
Newsgroups: comp.os.386bsd.misc
Subject: Re: change the super user password
Date: 31 May 1994 19:43:46 +0200
Organization: A Happy FreeBSD-current Usenet Site
Lines: 65
Message-ID: <2sft10$12c@keltia.frmug.fr.net>
References: <2s5rfj$j90@imladris.frmug.fr.net> <D> <1994May31.081353.5519@news.qut.edu.au>
NNTP-Posting-Host: keltia.frmug.fr.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

In article <1994May31.081353.5519@news.qut.edu.au>,
Babak Mohajerin <b.mohajerin@qut.edu.au> wrote:
>I have received a 486 pc running NetBSD without the superuser
>password. I tried to change it by going to single user mode and edit
>/etc/passwd and /etc/master.passwd. Althought I was able to do that, I
>couldn't log in as a superuser without a password entry. I wander if
>there is another file which has too be editied as well?

All  the flavours   of  BSD  use  shadow   passwords which are   stored  in
/etc/master.passwd   and   not in  /etc/passwd   (/etc/passwd  is  here for
compatibility in fact, almost nothing in the system use it directly).

The vipw(8) and passwd(1)  commands, which you *must* use  to edit user and
password  entries  run the pwd_mkdb(8)  command which  build two databases:
/etc/pwd.db and /etc/spwd.db. The former is without the passwords.

The library routines  getpwent(3) all  use the database  files  to get user
informations not the files themselves.

Therefore,   if you  edit  the  /etc/master.passwd  manually (something you
should *not* do except with vipw(8)), you must do the following:

[ensure nobody is trying to log in]
cd /etc
/bin/cp master.passwd ptmp
/usr/sbin/pwd_mkdb -p ptmp
rm -f ptmp

Now /etc/master.passwd is  a copy of /etc/ptmp,   /etc/passwd is an old  v7
password file (for   clients not using getpwent(3)   routines) and the  two
databases have been built properly.

------------------------------------------------------------
Here is the beginning of the pwd_mkdb(8) manpage :

PWD_MKDB(8)                                           PWD_MKDB(8)

NAME
       pwd_mkdb - generate the password databases

SYNOPSIS
       pwd_mkdb [ -p ] [ -d directory ] file

DESCRIPTION
       Pwd_mkdb creates db(3) style secure and insecure databases
       for  the  specified  file.   These  databases   are   then
       installed   into   ``/etc/spwd.db''   and  ``/etc/pwd.db''
       respectively.     The    file    is     installed     into
       ``/etc/master.passwd''.   The  file must be in the correct
       format (see passwd(5)).  It is important to note that  the
       format  used in this system is different from the historic
       Version 7 style format.

       The options are as follows:

       -p     Create a Version 7 style password file and  install
              it into ``/etc/password''.
------------------------------------------------------------

Hope to have been clear,
Ollivier
-- 
Ollivier ROBERT                                           roberto@hsc.fr.net
Hervé Schauer Consultants                Ollivier.Robert@keltia.frmug.fr.net
PERL / MIME / PGP 2.6ui     FreeBSD keltia 1.1.0(Current) CURRENT_082#0 i386