Red Hat Bugzilla – Bug 480632
usermod with -u option does not check the sanity of home directory
Last modified: 2009-04-14 06:27:11 EDT
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):
Steps to Reproduce:
1. usermod -d / someuser
2. usermod -u 1234 someuser
Error message or warning message and no change of ownership on files.
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.
This is not a bug, but I have suggested a small change in behaviour that could help.
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'.