diff --git a/newuser.sh b/newuser.sh index 438f33d..bb26684 100755 --- a/newuser.sh +++ b/newuser.sh @@ -1,14 +1,16 @@ #!/bin/sh -USER=$1 +SLBRUSER=$1 +test -z $SLBRUSER && echo "no user provided" && exit echo "Creating homedir..." -mkdir "/home/slbr/$USER" -echo "lxc exec $USER bash" > "/home/slbr/$USER/.profile" -chmod -w "/home/slbr/$USER/.profile" +mkdir "/home/slbr/$SLBRUSER" +echo $SLBRUSER >> users +echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile" +chmod -w "/home/slbr/$SLBRUSER/.profile" echo "Creating user..." -sudo useradd $USER -d "/home/slbr/$USER" -sudo usermod -a -G lxd $USER -sudo chown "$USER:$USER" "/home/slbr/$USER" -sudo chsh $USER -s /home/slbr/login.sh +sudo useradd $SLBRUSER -d "/home/slbr/$SLBRUSER" +sudo usermod -a -G lxd $SLBRUSER +sudo chown "$SLBRUSER:$SLBRUSER" "/home/slbr/$SLBRUSER" +sudo chsh $SLBRUSER -s /home/slbr/login.sh echo "Creating container..." -sudo su $USER -s /bin/sh -c "/home/slbr/lxcinit.sh" +sudo su $SLBRUSER -s /bin/sh -c "/home/slbr/lxcinit.sh" diff --git a/users b/users new file mode 100644 index 0000000..57d2d70 --- /dev/null +++ b/users @@ -0,0 +1,4 @@ +yetanotheruser +testuser +otheruser +someotheruser