From nobody@FreeBSD.org  Tue Jun 22 22:48:50 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 699B116A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 22 Jun 2004 22:48:50 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4C51643D58
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 22 Jun 2004 22:48:50 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i5MMmopk089687
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 22 Jun 2004 22:48:50 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i5MMmnUf089686;
	Tue, 22 Jun 2004 22:48:49 GMT
	(envelope-from nobody)
Message-Id: <200406222248.i5MMmnUf089686@www.freebsd.org>
Date: Tue, 22 Jun 2004 22:48:49 GMT
From: Bud Roth <budroth@obitori.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: KDE kuser corrupts passwd file when adding a user
X-Send-Pr-Version: www-2.3

>Number:         68213
>Category:       ports
>Synopsis:       KDE kuser corrupts passwd file when adding a user
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 22 22:50:24 GMT 2004
>Closed-Date:    Wed Jun 23 02:11:54 GMT 2004
>Last-Modified:  Wed Jun 23 02:11:54 GMT 2004
>Originator:     Bud Roth
>Release:        5.2.1 Release
>Organization:
>Environment:
FreeBSD barcroft.lake 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #1: Sun May 30 07:58:11 EDT 2004     root@barcroft.lake:/usr/src/sys/i386/compile/CURKERN  i386

>Description:
kuser is a program bundled with the KDE desktop port.  It adds users to the system.  Somehow, when it adds a user, it corrupts either the passwd or master.passwd file.  After the program is completed with its task, nobody can log into a TTY or su into a different user or use sudo.  PAM reports corrupt files and account passwd change dates have passed.  

Others have experienced this problem too:

http://bsdvault.net/viewtopic.php?topic=1153&forum=2

Hey all,

I run FreeBSD 5.1 with KDE 3.1.4.
I was just playing around seeing what gui tools came with and I found Kuser.
That is a problem. Kuser is bad...they need to fix it.

This is what happened:
Kuser deleted the first three lines from my /etc/master.passwd file and my /etc/passwd file.
Next thing I know I can't su to root because root doesn't exist.
Guess what else Kuser did?
It set the timeout on my user accounts to December 31, 1969 (or some date in the 1960s).
So I couldn't login at all.

Well Here is how to fix it.

1. Reboot the computer in Single User Mode (option 4 on boot menu)
2. Once booted you will be promted for your shell, just hit enter.
NOTE: Now in single user mode you only have read access
3. Get write access by typing in the following com mands:

    mount -u /
    mount -a


NOTE: That should give you write access. You should be logged in as toor.
4. copy your /var/backups/master.passwd.bak file to /etc/master.passwd and yes overwrite the old one.
5. Now just run the following command:

    pwd_mkdb -p /etc/master.passwd


That should fix your root account!

Thanks, I just wanted to post this somewhere since it took me hours to figure out.

Jared Barneck

Key words: recover root account - add root account - create root account - fix root account - root login - no such user root

>How-To-Repeat:
Use kuser to add a user.  Then, try to sudo or log in as any user or as root.  Nobody's password will work.  You are effectively locked out of the system.  (In my case, I could ssh into user "bud" because RSA-based authentication by-passed PAM, but I could not su or sudo su into root.)  
>Fix:
Credit to Jared Barneck:

1. Reboot the computer in Single User Mode (option 4 on boot menu)
2. Once booted you will be promted for your shell, just hit enter.
NOTE: Now in single user mode you only have read access
3. Get write access by typing in the following com mands:

    mount -u /
    mount -a


NOTE: That should give you write access. You should be logged in as toor.
4. copy your /var/backups/master.passwd.bak file to /etc/master.passwd and yes overwrite the old one.
5. Now just run the following command:

    pwd_mkdb -p /etc/master.passwd

This fixes the password problems, but does not prevent a repeat of the problem when kuser is used again.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Wed Jun 23 02:10:57 GMT 2004 
State-Changed-Why:  
Already fixed by checking of revision 1.25 (date: 2003/12/10 20:56:01) 
to sysutils/kdeadmin3.  If you upgrade to the current version you 
should see this problem go away. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68213 
>Unformatted:
