import-list: Recreate exim mailmandb if domain changed.
[clinton/scripts.git] / new-user
index fa4aff8..345f105 100755 (executable)
--- a/new-user
+++ b/new-user
@@ -58,8 +58,10 @@ if test -z "$EMAILADDR"; then
        echo "Skipping email forwarding, no email address was specified."
 else
        echo setting email forward to "$EMAILADDR"
        echo "Skipping email forwarding, no email address was specified."
 else
        echo setting email forward to "$EMAILADDR"
-       sh -c "echo '$EMAILADDR' > ~$USERNM/.public/.forward" || \
+       FORWARD_PATH=$(sh -c "echo ~$USERNM/.public/.forward")
+       echo "$EMAILADDR" > $FORWARD_PATH || \
        ( echo "Failed to set forward address" && exit 6 )
        ( echo "Failed to set forward address" && exit 6 )
+       chown $USERNM $FORWARD_PATH
 fi
 
 #
 fi
 
 #