Les Partages de Memiks
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
1 result tagged guid  ✕
A nicer way to mount your /home in LXD - Tribaal's blog https://tribaal.io/nicer-mounting-home-in-lxd.html
Wed Oct 31 23:39:44 2018 archive.org
QRCode
thumbnail

Mounting /home read-write
Allowing LXD to remap your user ID

The first step for that is to allow LXD to remap your user ID. Remember, LXD uses linux namespaces to isolate processes, and by default even root is not allowed to reuse UIDs from the host inside containers.

We want to allow the LXD demon (running as root) to remap our host's user ID inside a container:

Note: $UID is likely to be 1000 on an Ubuntu system if you're the only user.

echo "root:$UID:1" | sudo tee -a /etc/subuid /etc/subgid

This is a one time step, you'll never need to do this again on your host.
Remapping your user ID inside the container

Once LXD is allowed to remap your UID, we need to actually tell it to do it on a per-container basis:

lxd init ubuntu-daily:z remapped
lxc config set remapped raw.idmap "both $UID 1000"

There is a little bit of magic-looking syntax there, but "both $UID 1000" simply means "map both the UID and the GID, from the host's $UID to the guest's 1000".

We could instead set "uid $UID 1000" and "gid $(id -g) 1000" to be more explicit, but the "both" syntax is convenient.

lxd mount devices guid uid nobody
4756 links, including 1670 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn