17 lines
552 B
Bash
Executable File
17 lines
552 B
Bash
Executable File
#!/bin/sh
|
|
SLBRUSER=$1
|
|
test -z $SLBRUSER && echo "no user provided" && exit
|
|
|
|
echo "Creating homedir..."
|
|
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 $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 $SLBRUSER -s /bin/sh -c "/home/slbr/lxcinit.sh"
|