Bug 480632

Summary: usermod with -u option does not check the sanity of home directory
Product: [Fedora] Fedora Reporter: Lev Shamardin <shamardin>
Component: shadow-utilsAssignee: Peter Vrabec <pvrabec>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 10CC: pvrabec, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-14 10:27:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lev Shamardin 2009-01-19 15:07:26 UTC
Description of problem:
usermod when used with -u option blindly tries to change the ownership of all files in home directory to a new uid. This is not a good idea if the home directory is set to '/'.

Version-Release number of selected component (if applicable):
shadow-utils-4.0.18.1-22.fc8

How reproducible:
Always

Steps to Reproduce:
1. usermod -d / someuser
2. usermod -u 1234 someuser
  
Actual results:
Broken system.

Expected results:
Error message or warning message and no change of ownership on files.

Additional info:
I've ran into this bug by an accident while tuning a server running Fedora 8. I was fixing uid of users for compliance to a new local policy, and tried to change the uid of the user 'pulse' which had default home directory '/' on fedora 8 installation. Fortunately hit Ctrl-C just in time.

Comment 1 Peter Vrabec 2009-04-02 09:37:22 UTC
This is not a bug, but I have suggested a small change in behaviour that could help.
See upstream: 
http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2009-April/007065.html

Comment 2 Lev Shamardin 2009-04-02 09:45:30 UTC
Well, classification of such 'features' as bugs or features is a matter of philosophy.

Anyway, I completely agree with your proposed change. I would also suggest to add some option like 'force chown_tree anyway'.