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 #!/bin/sh
USER=$1 SLBRUSER=$1
test -z $SLBRUSER && echo "no user provided" && exit
echo "Creating homedir..." echo "Creating homedir..."
mkdir "/home/slbr/$USER" mkdir "/home/slbr/$SLBRUSER"
echo "lxc exec $USER bash" > "/home/slbr/$USER/.profile" echo $SLBRUSER >> users
chmod -w "/home/slbr/$USER/.profile" echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
chmod -w "/home/slbr/$SLBRUSER/.profile"
echo "Creating user..." echo "Creating user..."
sudo useradd $USER -d "/home/slbr/$USER" sudo useradd $SLBRUSER -d "/home/slbr/$SLBRUSER"
sudo usermod -a -G lxd $USER sudo usermod -a -G lxd $SLBRUSER
sudo chown "$USER:$USER" "/home/slbr/$USER" sudo chown "$SLBRUSER:$SLBRUSER" "/home/slbr/$SLBRUSER"
sudo chsh $USER -s /home/slbr/login.sh sudo chsh $SLBRUSER -s /home/slbr/login.sh
echo "Creating container..." 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