Behavior of usermod was improved regarding (re)moving the old homedir.
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
-rw-r--r-- foo:foo `/home/foo2/toto'
|
||||
drwxr-xr-x foo:foo `/home/foo2/.'
|
||||
drwxr-xr-x root:root `/home/foo2/..'
|
||||
@@ -0,0 +1 @@
|
||||
usermod: The previous home directory (/home/foo) was not a directory. It is not removed and no home directories are created.
|
||||
@@ -20,7 +20,24 @@ change_config
|
||||
touch /home/foo
|
||||
|
||||
echo -n "Change the user's home directory (usermod -m -d /home/foo2 foo)..."
|
||||
usermod -m -d /home/foo2 foo
|
||||
usermod -m -d /home/foo2 foo 2>tmp/usermod.err && exit 1 || {
|
||||
status=$?
|
||||
}
|
||||
echo "OK"
|
||||
|
||||
echo -n "Check returned status ($status)..."
|
||||
test "$status" = "12"
|
||||
echo "OK"
|
||||
|
||||
echo "usermod reported:"
|
||||
echo "======================================================================="
|
||||
cat tmp/usermod.err
|
||||
echo "======================================================================="
|
||||
echo -n "Check that there were a failure message..."
|
||||
diff -au data/usermod.err tmp/usermod.err
|
||||
echo "error message OK."
|
||||
rm -f tmp/usermod.err
|
||||
|
||||
echo "OK"
|
||||
|
||||
echo -n "Check the passwd file..."
|
||||
@@ -38,17 +55,9 @@ echo "OK"
|
||||
echo -n "Check /home/foo was not removed..."
|
||||
test -f /home/foo
|
||||
echo "OK"
|
||||
ls /home
|
||||
echo -n "Check the user's home directory was moved..."
|
||||
test -d /home/foo2
|
||||
echo -n "Check the user's home directory was not created..."
|
||||
test ! -e /home/foo2
|
||||
echo "OK"
|
||||
echo -n "Check content of /home/foo2/..."
|
||||
stat --printf "%A %U:%G %N\n" /home/foo2/* /home/foo2/.* 2>/dev/null | sort > tmp/home_ls-a
|
||||
diff -rauN data/home_ls-a tmp/home_ls-a
|
||||
echo "OK"
|
||||
echo -n "Remove the new home directory..."
|
||||
rm -rf /home/foo2
|
||||
echo "done"
|
||||
|
||||
rm -f /home/foo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user