Keep track of users
This commit is contained in:
parent
d8829edb60
commit
dc54640143
20
newuser.sh
20
newuser.sh
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue