Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jun 2004 22:48:49 GMT
From:      Bud Roth <budroth@obitori.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/68213: KDE kuser corrupts passwd file when adding a user
Message-ID:  <200406222248.i5MMmnUf089686@www.freebsd.org>
Resent-Message-ID: <200406222250.i5MMoOuE026242@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 22 22:50:24 GMT 2004
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406222248.i5MMmnUf089686>