lxc patch 2
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user