Keep track of users

This commit is contained in:
sose 2018-09-14 19:39:19 +02:00
parent d8829edb60
commit dc54640143
2 changed files with 15 additions and 9 deletions

View File

@ -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"

4
users Normal file
View File

@ -0,0 +1,4 @@
yetanotheruser
testuser
otheruser
someotheruser