Bug 474832 - Cannot set password for a user if not already in shadow password file
Cannot set password for a user if not already in shadow password file
Product: Fedora
Classification: Fedora
Component: pam (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Tomas Mraz
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-12-05 10:16 EST by Ed Avis
Modified: 2009-02-11 03:40 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-02-11 03:40:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ed Avis 2008-12-05 10:16:06 EST
(This might be a bug against PAM rather than the passwd program itself.)

If you add a user by hand to the /etc/passwd and /etc/group files, for whatever reason, then you might expect 'passwd user' to set the password.  However, it prompts for the password and then prints

passwd: User not known to the underlying authentication module

You can work around this by adding a dummy line to the shadow password file:

# echo 'user:!!:14202:0:99999:7:::' >>/etc/shadow

However, it would be better if the passwd program were more robust, and seeing that the user is not currently mentioned in /etc/shadow, would add the new line itself.

To reproduce: manually add a user to /etc/passwd.  Run 'passwd user'.

Expected result: the usual password prompt then add an entry to /etc/shadow if missing, or update the existing entry in /etc/shadow if present.

Actual result: prompts for password but then fails with 'User not known'.
Comment 1 Tomas Mraz 2008-12-08 03:50:55 EST
What was the exact line you added to the /etc/passwd by hand?
Comment 2 Tomas Mraz 2009-02-11 03:40:52 EST
pam_unix module does not support creating shadow entries from scratch. You should use the shadow-utils or utils from libuser to create user entries. Or if you need  just to add a shadow entry for an user you should call pwconv.

Note You need to log in before you can comment on or make changes to this bug.