2

I am looking for an overlay file system that can present a set of underlying files and folders but with modified owner and group. Is there such a thing?

The idea is to share the same set of data across several userns-based LXC guests.

So the mapping should be from one range of UIDs and GIDs to another (equally big) range of UIDs and GIDs (subordinate on the host).

4
  • 2
    Modified according to what rules? All to one user? A uid-to-uid map? A list of filename-uid pairs? Commented Jul 24, 2015 at 18:53
  • @Gilles: yes, UID to UID and GID to GID. This should be more or less obvious from the mentioning of userns, but let's make it explicit :) Commented Jul 25, 2015 at 12:28
  • 1
    Does the obvious candidate bindfs work for you? (example) It does uid/gid mappings, but I'm not sure if that will help with your use case, since its mappins are inside whatever namespace the bindfs process runs, not between namespaces. Commented Jul 25, 2015 at 12:32
  • @Gilles: it might, still looking into it. Feel free to write that up as an answer. Commented Jul 25, 2015 at 13:21

1 Answer 1

1

The bindfs filesystem (based on FUSE) is an overlay filesystem with the capability to remap user and group IDs. The mappings must be given on the bindfs command line when mounting the filesystem, with the --map command line option or map mount option. A mapping of the form 123/456 causes files owned by user 123 to be shown as owned by user 456. A mapping @123/456 does the same for groups. You can use user and group names that are visible to the bindfs process. Beware that only traditional permissions are affected, ACL entries are not remapped.

Example:

bindfs --map=123/456:@staff/nogroup /srv/shared/daat /srv/containers/foo/data

I'm not sure if this would help you since it doesn't do remapping between user namespaces, the remapping is done in the namespace of the bindfs process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.