SLBR/newuser.sh

15 lines
423 B
Bash
Executable File

#!/bin/sh
USER=$1
echo "Creating homedir..."
mkdir "/home/slbr/$USER"
echo "lxc exec $USER bash" > "/home/slbr/$USER/.profile"
chmod -w "/home/slbr/$USER/.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
echo "Creating container..."
sudo su $USER -s /bin/sh -c "/home/slbr/lxcinit.sh"