RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1016516 - usermod exits with exit status 0 even when it fails.
Summary: usermod exits with exit status 0 even when it fails.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: shadow-utils
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Dalibor Pospíšil
URL:
Whiteboard:
Depends On:
Blocks: 994246 1056252
TreeView+ depends on / blocked
 
Reported: 2013-10-08 10:05 UTC by Christos Triantafyllidis
Modified: 2018-12-09 17:12 UTC (History)
4 users (show)

Fixed In Version: shadow-utils-4.1.4.2-14.el6
Doc Type: Bug Fix
Doc Text:
Cause: The usermod code did not properly handle creation of new entry in /etc/shadow. Consequence: The usermod -p command failed to set the new password if the entry in /etc/shadow file was missing. Fix: The usermod code now properly creates new entry in /etc/shadow if it is missing. Result: The usermod -p command sets the new password correctly even if the user's entry in /etc/shadow is missing.
Clone Of:
Environment:
Last Closed: 2014-10-14 07:17:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1522 0 normal SHIPPED_LIVE shadow-utils bug fix update 2014-10-14 01:22:10 UTC

Description Christos Triantafyllidis 2013-10-08 10:05:24 UTC
Description of problem:
When the usermod is requested to change the password of a user that is not listed in /etc/shadow it returns exit code 0 although it fails.

Version-Release number of selected component (if applicable):
shadow-utils-4.1.4.2-13.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create a local user:
# useradd -M -u 99999 -g 99 -c 'Test Local User' testluser
[root@jumphost ~]# id testluser
uid=99999(testluser) gid=99(nobody) groups=99(nobody)
2. Set a password (optional):
# echo "pass" | passwd --stdin testluser
Changing password for user testluser.
passwd: all authentication tokens updated successfully.

3. Verify: 
# grep testluser /etc/shadow
testluser:$6$z4ZsFGEN$Tlp8Nrhe53RIp8XdgiNBSb0g1o./4kXh7vWgCH2Bn1Pc/7sNJ8/hE9KbNUBbUz3L/rmGNry8Ma4JewvwzSX1F.:15978:0:99999:7:::
# grep testluser /etc/passwd
testluser:x:99999:99:Test Local User:/home/testluser:/bin/bash

4. Remove user's entry from /etc/shadow:
# sed -i -e '/^testluser:/d' /etc/shadow
# grep testluser /etc/shadow

5. Attempt to set user password with usermod:
# usermod -p 'XinvalidX' testluser
# echo $?
0

6. Check the shadow file:
# grep testluser /etc/shadow

Actual results:
No entries returned in /etc/shadow and no error code in usermod

Expected results:
Either an error message in usermod or a new entry in /etc/shadow

Additional info:

Comment 1 RHEL Program Management 2013-10-13 23:02:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 5 Tomas Mraz 2014-06-05 13:21:20 UTC
The backported fix causes usermod to create new shadow entry if it is missing if the contents of the passwd entry indicates that the user has shadow password. Otherwise the passwd entry is modified with the new password.

Comment 8 errata-xmlrpc 2014-10-14 07:17:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1522.html


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