Skip to content

Instantly share code, notes, and snippets.

@nojima
Created March 5, 2014 04:38
Show Gist options
  • Save nojima/9361260 to your computer and use it in GitHub Desktop.
Save nojima/9361260 to your computer and use it in GitHub Desktop.
ssh to an LXC container.
#!/bin/sh -e
if [ "$1" = "" ]; then
echo "Usage: lxc-ssh NAME [ARGS]"
exit 1
fi
NAME=$1
ADDR=$(sudo lxc-info -n $NAME | awk -F': *' '/^IP:/ { print $2 }')
shift
exec ssh -l ubuntu -o StrictHostKeyChecking=no $ADDR $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment