*BSD News Article 34028


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!panix!not-for-mail
From: wpaul@panix.com (Bill Paul)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Cant add new account in FreeBSD 1.1.5.1
Date: 8 Aug 1994 12:54:23 -0400
Organization: The M00se Illuminati (bl00p!)
Lines: 80
Distribution: world
Message-ID: <325nvv$o6t@panix3.panix.com>
References: <wgalazka.180.2E4621E6@chem.uw.edu.pl>
NNTP-Posting-Host: panix3.panix.com
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se, Wojciech Galazka
(wgalazka@chem.uw.edu.pl) had the courage to say:
: Hi all,
: I'm, trying to set up new account on my FreeBSD 1.1.5.1. I've added
: new line to /etc/passwd and to /etc/master.passwd but nothing happened :(
: Seems to me these two files are not read at all ! I still get that root's
: name 
: is Charlie Roor although I've changed "Charlie Root" in /etc/master.passwd
: to "El Commendante" - finger still claims it's "Charlie ":( 
: What should I do now ?
:                 Wojciech Galazka

#ifdef PATRONIZING_MODE

What you should have done in the first place:

man passwd
man vipw
man chpass
man pwd_mkdb

Please read happy fun manual. Happy fun manual is your friend. :)

#else

If you look in /etc you will find two files named pwd.db and spwd.db
which are the real user/password databases that login and friends consult
when authenticating passwords. Scanning very large text-based password
files can take a long time, and in some cases your login will actually
timeout before your entry in the password file can be found (this happened
a lot with nyx.cs.du.edu in its early days: there were thousands of users
and the machine was dead slow -- getting in could be a real challenge).
The .db files help avoid this: with small password files they won't
have much of an effect, but searching a very large database file is
significantly faster than searching a very large text file. 

Anyway, standard practice is to edit the password database using either
vipw (to add/delete users) or chpass (to change things about existing
users). Both of these programs run 'pwd_mkdb' which updates pwd.db and
spwd.db using /etc/passwd and /etc/master.passwd (respectively) as
templates. vipw and chpass use vi by default, though you can set your
EDITOR environment variable to point to your favorite editor to override
this. Note that normal users are allowed to use chpass to change
some some things themselves (like their real name, finger information
or shell -- chfn and chsh are links to chpass), but only root can
change everything.

If, and I stress *IF*, your /etc/passwd and /etc/master.passwd files
don't have any errors in them, you can manually update your user databases
just by running pwd_mkdb as root. After that, the changes you made will
take effect. Just using passwd to reset the password on an existing
account should work too. Again, it is usually best to use vipw for this
since it keeps both /etc/passwd and /etc/master.passwd in synch for you.

Standard precautions apply here: don't log out until you're sure the
system will let you back in again. If you somehow manage to lock yourself
out of your own machine (don't laugh: it can happen to the best of us :),
you'll have to reboot in single-user mode (type -s at the boot prompt)
and do the following:

# mount -u -w /    (mount / read-write)
# mount /usr       (vipw & friends are on /usr)
# vipw
[do what you have to do to demangle the password file]
# sync
# ^D               (exit single-user shell to continue multi-user boot)

Hope this helps.

#endif /* PATRONIZING_MODE */

-Bill

--
 _      /\      _            Join the
/ \_/\_/  \_/\_/ \  .----.   M00se Illuminati   Bill Paul 
\_____/ () \_____/ (bl00p!)  Face it: wouldn't  <Big City M00se>
     /      \       `----'   you feel much      wpaul@panix.com   -or-
    /  \__/  \    --'        safer?             ghod@drycas.club.cc.cmu.edu
   /__________\