Skip to content

Add option to map uid and gid ranges #171

@gaboose

Description

@gaboose

It would be useful to have an option that works like --uid-offset and --gid-offset and --map put together. I.e. shifts a range of a certain length of uids and gids by a certain offset.

It could look like --map=0/1000/1:1/100000/65536:@0/@1000/1:@1/@100000/65536, which would be similar to the format in /proc/.../uid_map and /proc/.../gid_map.

Use Case

Podman stores its rootless images with the following mapping:

$ podman unshare cat /proc/self/uid_map
         0       1000          1
         1     100000      65536
$ podman unshare cat /proc/self/gid_map
         0       1000          1
         1     100000      65536

Which means 0 -> 1000 and [1;65536] -> [100000;165535].

I have a workflow that rsyncs files from a rootless podman image to a mounted physical device while preserving ownership. That's only possible because I can remount the physical device to match podman image uids and gids with bindfs.

I.e. sudo bindfs /run/media/.../rootfs1 ~/rootfs1-remapped --map=0/1000:1000/100999:999/100998:@8/@100007:@0/@1000:@7/@100006:@1000/@100999:@999/@100998.

But this doesn't cover the whole range and trying to do that with the current version would make the --map value unfeasibly large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request/PR

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions