[lxc-users] Tool for shifting subuids and subgids
bostjan at a2o.si
Mon Oct 12 12:27:38 UTC 2015
does this tool have a name?
IMHO it is missing -r switch that is present in uidmapshift.c (info about
existing uids, gids).
Additionally, uidmapshift can limit its scope of operation, and not just
directory-wise, but also by id-range. For example, if you run uidmapshift
on a directory with "-r 0 1000000 100000 /path/to/dir" arguments, and it
dies in the middle of the process for whatever reason, you can just rerun
the same command and the end result will be consistent, as it will not
touch UIDs above 100.000.
On the other hand, using your tool with arguments "0 1000000 /path/to/dir",
I will end up with some files in 1.000.000-1.100.000 and other files (that
were affected by both runs) in 2.000.000-2.100.000 UID/GID range.
Do not get me wrong, I managed to scr*w permissions with uidmapshift too,
but here the possibility of doing it is even greater.
My 2 cents,
PS: Creating wrapper script that does one short repeated task for you might
seem better approach instead of rewriting uidmapshift's functionality in
On 7 October 2015 at 13:24, <teemu.gronqvist at net9.fi> wrote:
> Hello everyone,
> Made this tool in the morning. It can be used to shift subuid and subgid
> maps of unprivleged containers easily to bigger or smaller range making
> migrations and things like that a whole lot easier. I’m not sure if LXD
> does this by default when migrating, but anyways yeah, it’s a good tool for
> plain LXC to say the least.
> It is very useful for our company so I thought that someone else might
> find it useful as well.
> Here’s the source for anyone interested: http://paste.ubuntu.com/12703540/
> This is based on the C version found at
> https://github.com/fcicq/nsexec/blob/master/uidmapshift.c but this one is
> instead programmed in Python needing no compiling etc.
> I have tested it a few times on a few folders but it might have some bugs,
> so maybe someone more experienced in Python than me might want to give it a
> Kind regards,
> Teemu Grönqvist
> Net9 Oy
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lxc-users