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
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue