Addded ssh key auth
This commit is contained in:
parent
bfba4730fd
commit
500e51695f
|
@ -29,7 +29,7 @@ contact ~ben or sose on tilde.chat (in the #slbr channel) to sign up.
|
||||||
- Once all of your users are created and logged in, run `echo "1" > gamestatus` to start the game.
|
- Once all of your users are created and logged in, run `echo "1" > gamestatus` to start the game.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- Handling of ssh keys and/or passwords
|
|
||||||
- Install-time configuration (setting proper ips, hostname, etc.)
|
- Install-time configuration (setting proper ips, hostname, etc.)
|
||||||
|
- A goal and a way to check it
|
||||||
|
|
||||||
This is a ~ work in progress ~
|
This is a ~ work in progress ~
|
||||||
|
|
12
newuser.sh
12
newuser.sh
|
@ -5,15 +5,19 @@ test -z "$SLBRUSER" && echo "no user provided" && exit
|
||||||
|
|
||||||
echo "Creating homedir..."
|
echo "Creating homedir..."
|
||||||
mkdir "/home/slbr/$SLBRUSER"
|
mkdir "/home/slbr/$SLBRUSER"
|
||||||
|
mkdir "/home/slbr/$SLBRUSER/.ssh"
|
||||||
|
echo "Copying key..."
|
||||||
|
echo "$PUBKEY" >> "/home/slbr/$SLBRUSER/.ssh/authorized_keys"
|
||||||
echo "$SLBRUSER" >> users
|
echo "$SLBRUSER" >> users
|
||||||
|
echo "Creating container..."
|
||||||
echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
|
echo "lxc exec $SLBRUSER bash" > "/home/slbr/$SLBRUSER/.profile"
|
||||||
chmod -w "/home/slbr/$SLBRUSER/.profile"
|
chmod -w "/home/slbr/$SLBRUSER/.profile"
|
||||||
echo "Creating user..."
|
echo "Creating user..."
|
||||||
sudo useradd "$SLBRUSER" -d "/home/slbr/$SLBRUSER"
|
sudo useradd "$SLBRUSER" -d "/home/slbr/$SLBRUSER"
|
||||||
sudo usermod -a -G lxd "$SLBRUSER"
|
sudo usermod -a -G lxd "$SLBRUSER"
|
||||||
sudo chown "$SLBRUSER:$SLBRUSER" "/home/slbr/$SLBRUSER"
|
sudo chown -R "$SLBRUSER:$SLBRUSER" "/home/slbr/$SLBRUSER"
|
||||||
sudo chsh "$SLBRUSER" -s /home/slbr/login.sh
|
sudo chsh "$SLBRUSER" -s /home/slbr/login.sh
|
||||||
echo "Creating container..."
|
echo "Generating user keypair..."
|
||||||
|
sudo su "$SLBRUSER" -s /bin/sh -c "ssh-keygen -t rsa -N '' -f /home/slbr/$SLBRUSER/.ssh/id_rsa"
|
||||||
|
echo "Initializing container..."
|
||||||
sudo su "$SLBRUSER" -s /bin/sh -c "/home/slbr/lxcinit.sh"
|
sudo su "$SLBRUSER" -s /bin/sh -c "/home/slbr/lxcinit.sh"
|
||||||
mkdir "/home/slbr/$SLBRUSER/.ssh"
|
|
||||||
echo "$PUBKEY" >> "/home/slbr/$SLBRUSER/.ssh/authorized_keys"
|
|
||||||
|
|
Loading…
Reference in New Issue