From owner-freebsd-questions@FreeBSD.ORG Wed Feb 4 14:52:35 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6BF216A4CE for ; Wed, 4 Feb 2004 14:52:34 -0800 (PST) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id D559D43D48 for ; Wed, 4 Feb 2004 14:52:32 -0800 (PST) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from be-well.no-ip.com ([66.30.196.44]) by comcast.net (sccrmhc11) with ESMTP id <2004020422523101100j2caee>; Wed, 4 Feb 2004 22:52:31 +0000 Received: by be-well.no-ip.com (Postfix, from userid 1147) id BF7B211; Wed, 4 Feb 2004 17:52:31 -0500 (EST) Sender: lowell@be-well.ilk.org To: Vince Sabio References: <44n07zvsay.fsf@be-well.ilk.org> From: Lowell Gilbert Date: 04 Feb 2004 17:52:31 -0500 In-Reply-To: Message-ID: <44hdy6bgpc.fsf@be-well.ilk.org> Lines: 81 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: freebsd-questions@freebsd.org Subject: Re: Cannot Add User X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2004 22:52:35 -0000 Vince Sabio writes: > ** Sometime around 09:21 -0500 02/04/2004, Lowell Gilbert sent everyone: > >Vince Sabio writes: > > > >[...] > > > I'm now trying to install Postfix, and the problem I'm running into is > >> that I cannot create new user accounts. I created several user > >> accounts during installation, and they seem to be fine. But when I > >> [manually] create entries in /etc/passwd, master.passwd, and group, > >> the entries are 'ignored' -- e.g., a "chown [newuser] [filename]" > >> command fails, attempts to su from root into the user account fail, > >> etc. When I try to create the user via adduser (using the standard > >> defaults), the account creation step fails with the following error: > >> > > > pw: user '[newuser]' disappeared during update > > > >It sounds like you've messed up your user database. Try running > >pwd_mkdb(8) by hand to get it straightened out. In future, remember > >not to edit passwd and so forth by hand; stick with adduser(8) and/or > >vipw(8) to avoid shooting yourself in the foot like this. > > I have to wonder if this is unique to the BSDs; I've been using > Solaris for nearly a decade now, and the _only_ way I've ever created > user accounts is manually -- by editing /etc/passwd, shadow, and group > files, creating user directories, etc. I've never had a problem with > it before. (I'm pretty sure I've done the same under Linux, too.) Right. By default, FreeBSD uses databases to hold account information; the "passwd" file is present only for backward compatibility, and the "master.passwd" is used only as an *input* from which the databases are created. > Running adduser is fine for simple user accounts -- but there are few > user accounts on a typical server. The problem with adduser is that it > isn't well suited to things like accounts with no home directories or > login shells, disabled passwords (not the same as a locked account), > etc. Normally I do those directly with vipw(8). If I were automating those, I'd use pw(8). > Either way, I tried running pwd_mkdb -C /etc/passwd, and it reported a > format error on line 3 -- which happens to be the root account, and is > the first real data line in the file. That file has a slightly different format: you wanted "pwd_mkdb /etc/master.passwd" > Moreover, it's a line that I > didn't modify. It reported no errors on /etc/master.passwd, so I > copied and modified it into a passwd file -- and pwd_mkdb then > reported no errors on the new passwd file. However, that action also > prevented any new logins, and running passwd didn't fix the problem. Here we've got an actual problem. There were a number of chances for bogus data to creep into the file, but in case of future problems, note that master.passwd is among the things that gets automatically backed up into /var/backups. > So, after mucking around with pwd_mkdb for a while, I opted to simply > reinstall the OS -- it was still a rather new installation, and I > wanted to increase the /usr partition, anyway. After completing the > new FreeBSD installation, the first thing I did upon logging in was > run pwd_mkdb on /etc/passwd, and it still reported a format error on > line 3. I then manually added the necessary users, and this time the > postfix installation ran to completion. The postfix port adds all the necessary users for you, and does it correctly. [The next time you add a *real* new user, your postfix changes will be wiped out by pwd_mkdb.] > While it's possible that I messed up the format on the original try, > it's unlikely -- I checked it over a dozen times before going in > search of a FreeBSD list on which to ask the question. I'm thinking > that there might have been something else in the mix. But either way, > the clean install fixed it (though admittedly it was a rather > Draconian fix). Just use vipw(8) to make your changes to the password database, and all the tricky bits will be handled for you.