Skip to content

Instantly share code, notes, and snippets.

@3XX0
Last active April 14, 2018 01:15
Show Gist options
  • Save 3XX0/b3e2bd829d43104cd120f4258c4eeca9 to your computer and use it in GitHub Desktop.
Save 3XX0/b3e2bd829d43104cd120f4258c4eeca9 to your computer and use it in GitHub Desktop.
#! /bin/sh
USER=$(whoami)
USER_ID=$(id -u)
GROUP_ID=$(id -g)
LXC_CONF_DIR="${HOME}/.config/lxc"
LXC_CACHE_DIR="${HOME}/.cache/lxc"
mkdir -p ${LXC_CONF_DIR} ${LXC_CACHE_DIR}
cat > ${LXC_CONF_DIR}/default.conf <<EOF
lxc.include = /etc/lxc/default.conf
lxc.idmap = u 0 ${USER_ID} 1
lxc.idmap = u 1 ${USER_ID}000 1000
lxc.idmap = g 0 ${GROUP_ID} 1
lxc.idmap = g 1 ${GROUP_ID}000 1000
lxc.mount.entry = ${HOME} home/${USER} none bind,nodev,nosuid,create=dir 0 0
lxc.environment = HOME=${HOME}
lxc.environment = USER=${USER}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment