lxc patch 2

This commit is contained in:
2026-04-11 09:41:24 -04:00
parent 23d93b709b
commit 18c6972b23
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -17,6 +17,7 @@ sleep 5
# set root password, install SSH, inject key
lxc-attach -n "$CONTAINER" -- /bin/bash -c "
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
apt-get update && apt-get install -y openssh-server
mkdir -p /root/.ssh
chmod 700 /root/.ssh
@@ -26,8 +27,11 @@ lxc-attach -n "$CONTAINER" -- /bin/bash -c "
"
# push the key in
cat "$KEYFILE" | lxc-attach -n "$CONTAINER" -- tee /root/.ssh/authorized_keys > /dev/null
lxc-attach -n "$CONTAINER" -- chmod 600 /root/.ssh/authorized_keys
cat "$KEYFILE" | lxc-attach -n "$CONTAINER" -- /bin/bash -c "
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
tee /root/.ssh/authorized_keys > /dev/null
chmod 600 /root/.ssh/authorized_keys
"
# auto-start on boot
echo "lxc.start.auto = 1" >> "/var/lib/lxc/${CONTAINER}/config"