summaryrefslogtreecommitdiff
path: root/scripts/debian_roll
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2020-02-14 01:52:47 -0600
committerTom Barrett <tom@tombarrett.xyz>2020-02-14 01:52:47 -0600
commit814f256f9055fd4c90ef19ffbde3f852f2927939 (patch)
tree46bd81aa74467ce3e6dacaf28aabce750fb8e2f7 /scripts/debian_roll
parent5ec4f68cf028c00939838327f25433e5352f1992 (diff)
on the way to kerb
Diffstat (limited to 'scripts/debian_roll')
-rwxr-xr-xscripts/debian_roll30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/debian_roll b/scripts/debian_roll
new file mode 100755
index 0000000..56c5e5b
--- /dev/null
+++ b/scripts/debian_roll
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -e
+
+NAME=$1
+USER=tom
+PASS=durr
+
+# init
+lxc-create -n $NAME -t download -- --dist debian --release buster --arch amd64
+lxc-start -n $NAME
+# TODO maybe just info until ip shows up?
+sleep 15
+
+# install basics
+lxc-attach -n $NAME -- apt update
+lxc-attach -n $NAME -- apt dist-upgrade
+lxc-attach -n $NAME -- apt install -y sudo openssh-server x11-xserver-utils
+
+# setup user
+lxc-attach -n $NAME -- adduser $USER --gecos "" --disabled-password
+lxc-attach -n $NAME -- bash -c 'echo -e "'$PASS'\n'$PASS'" | passwd $USER'
+
+# setup x11 forwarding
+lxc-attach -n $NAME -- bash -c 'echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config'
+lxc-attach -n $NAME -- bash -c 'echo "X11UseLocalhost yes" >> /etc/ssh/sshd_config'
+lxc-attach -n $NAME -- bash -c 'echo "PermitRootLogin yes" >> /etc/ssh/sshd_config'
+lxc-attach -n $NAME -- systemctl restart sshd
+
+# display info
+lxc-info -n $NAME