Bug 128 - Hashed passwd ends up in /etc/passwd even with shadow enabled
Hashed passwd ends up in /etc/passwd even with shadow enabled
Product: Red Hat Linux
Classification: Retired
Component: distribution (Show other bugs)
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Cristian Gafton
: Security
Depends On:
  Show dependency treegraph
Reported: 1998-11-18 23:15 EST by seva
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1998-11-20 07:14:25 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 seva 1998-11-18 23:15:46 EST
Verified on RHL 5.1 and 5.2

1. Install RHL

2. Set up shadowed passwd with 'pwconv'
   From here on /etc/passwd should not contain any
   passwd hashes (right?)

3. Add a test user ('adduser test1')
   and set a passwd ('passwd test1')
   hash is now in /etc/shadow as it is supposed to be

4. Disable the user by putting '*' in the passwd field of
   /etc/shadow (replace the hash with '*' not prepand it)

5. Enable the account by changing passwd ('passwd test1')

6. Account is valid, but the hash has ended up in world
   readable /etc/passwd (not private /etc/shadow)

If in step 4 you prepand '*' to the hash this will fail and
the passwd command will work as designed.

Is this the correct behaviour of passwd/shadow?

Comment 1 Aleksey Nogin 1998-11-19 08:41:59 EST
I believe this is normal behavour - by default, passwd puts the new
password in the same file, where you had the old one. In the case you
did not have any, it thinks you had it in /etc/passwd...
You can tell passwd to always put the new password into the shadow
file by changing
password   required     /lib/security/pam_pwdb.so use_authtok nullok
line in /etc/pam.d/passwd  to
password   required     /lib/security/pam_pwdb.so shadow use_authtok
Comment 2 seva 1998-11-19 09:00:59 EST
Hmm, ok I'll try that, but may be RHS should make that default after
'pwconv' has run?

Comment 3 seva 1998-11-19 09:20:59 EST
ayn2@cornell.edu's suggestion does work.  I think pwconv should make
it this way by default.

But also note that if the /etc/shadow has '*HASH' or '!!' in the
passwd field then the passwd gets put there and not /etc/passwd even
w/out this change.

Comment 4 Cristian Gafton 1998-11-20 07:14:59 EST
/etc/pam.d/passwd should have the 'shadow' argument to pam_pwdb

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