Now exporting the vserver rlimit interface directly, which can be used to
[util-vserver.git] / scripts / vuseradd
index 177466a..429a959 100755 (executable)
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 2004  The Trustees of Princeton University (Trustees).
 #
-# $Id: vuseradd,v 1.17 2004/11/17 19:35:47 mef Exp $
+# $Id: vuseradd,v 1.20 2004/11/23 14:47:35 mlhuang Exp $
 #
 
 : ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
@@ -29,6 +29,9 @@ groupadd slices 2>/dev/null || :
 # add user
 useradd -g slices -s /bin/vsh $NAME
 
+# openssh-server 3.8 and above refuse login for "locked" accounts
+sed -i -e "s/$NAME:\!\!:\(.*\)/$NAME:*:\1/" /etc/shadow
+
 USERID=$(awk -F: "\$1 == \"$NAME\" { print \$3 }" < /etc/passwd)
 GROUPID=$(awk -F: "\$1 == \"slices\" { print \$3 }" < /etc/group)
 
@@ -56,9 +59,8 @@ if [ ! -d "$VROOTDIR/$NAME" ] ; then
        # move it to .vcache when complete
        if [ $RETVAL -ne 0 ] ; then 
            echo "Error $RETVAL building $VROOTDIR/$NAME"
-           chattr -R -i "$TMP"
-           rm -rf "$TMP"
-           userdel $NAME
+           rm -rf "$TMP" /etc/vservers/$NAME.conf /var/run/vservers/$NAME.ctx
+           userdel -r $NAME
            exit $RETVAL
        else
            # sanity check