blob: b4bf2fe78305b2d3773197b5e0b8942ff5c153b0 (
plain)
1
2
3
4
5
6
7
8
9
|
#!/usr/bin/env bash
IP=$(lxc ls -fcsv | grep $1 | tr ' ' , | cut -d, -f3)
if ! ssh -o BatchMode=yes root@$IP; then
lxc exec $1 -- bash -c "mkdir -p /root/.ssh && \
echo \"$(ssh-add -L)\" \
> /root/.ssh/authorized_keys"
ssh root@$IP
fi
|