<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000"><div>Hi,</div><div><br data-mce-bogus="1"></div><div>I'm looking to move unprivileged containers from one host to another. <br>I'm actually moving pure LXC containers to a new LXD/LXC host</div><div><br data-mce-bogus="1"></div><div>I would like to know how should I deal with the uid/gid inside the container.</div><div>The root uid/gid is différent on the new host. But I can simply remplace the old UID/GUID by the new one with a find request but how should I do with the other users id used inside the container ?</div><div><br data-mce-bogus="1"></div><div>I did not understand where the uid/gid map is done </div><div><br>Inside the container</div><div>root@w4a:~# id ubuntu<br>uid=1000(ubuntu) gid=1000(ubuntu) </div><div><br data-mce-bogus="1"></div><div>Folder :</div><div>drwxr-xr-x 2 ubuntu ubuntu 6 Jul 8 23:17 ubuntu</div><div><br data-mce-bogus="1"></div><div>Outside the container </div><div>drwxr-xr-x 2 166536 166536 6 Jul 8 23:17 ubuntu</div><div><br data-mce-bogus="1"></div><div>How the system know about uid/gid 1000 inside container = uid/gid <span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;">166536 outside the container </span></div><div>It look like root uid = 165536 outside the container and it is defined by lxc configuration <br>id 1000 inside the container will be root uid + user id , so 165536 + 1000 = <span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;">166536 </span></div><div><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;"><br data-mce-bogus="1"></span></div><div><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;">But what is two container have a user uid 100 ? they will both avec the same uid outside the container ? </span></div><div><span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;"><br data-mce-bogus="1"></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">About migrate the container from, how should I manage it ?</span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">Should I re-do the mapping myself ? Like looking into /etc/passwd inside the container then use the root uid + the id found for that user in /etc/passwd and replace the old uid/gid by the new one ? Maybe there is faster/better solution ?</span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"><br data-mce-bogus="1"></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">I was looking to add an uid/gid mapping to match the container configuration as it was before, but it does not look to work </span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"><br data-mce-bogus="1"></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">I have this as an example in a config file dedicated for the container on the LXC pure host. </span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"># Container specific configuration<br>lxc.id_map = u 0 951968 65536<br>lxc.id_map = g 0 951968 65536<br></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"><br data-mce-bogus="1"></span></div><div>Here is what I did to the new host : </div><div>cat /etc/subuid<br>gxd:100000:65536<br>root:165536:65536<br>root:951968:65536<br></div><div><br data-mce-bogus="1"></div><div>I also tried to set lxc.raw </div><div><br data-mce-bogus="1"></div><div>cat << EOF |lxc config set test-ct raw.lxc -<br>lxc.id_map = u 0 <span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;">951968 65536</span><br>lxc.id_map = g 0 <span style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: #ffffff;">951968 65536</span><br>EOF<br></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"><br data-mce-bogus="1"></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">But in that case, container does't start.</span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;"><br data-mce-bogus="1"></span></div><div><span style="font-size: 13.3333px;" data-mce-style="font-size: 13.3333px;">Thanks for you help :)</span></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div data-marker="__SIG_PRE__"><div><span style="color: rgb(51, 51, 51); font-family: times new roman,new york,times,serif;" data-mce-style="color: #333333; font-family: times new roman,new york,times,serif;">Cordialement,</span><span style="color: rgb(51, 51, 51); font-family: times new roman,new york,times,serif; font-weight: bold;" data-mce-style="color: #333333; font-family: times new roman,new york,times,serif; font-weight: bold;"><span style="color: rgb(51, 51, 51); font-family: times new roman,new york,times,serif; font-weight: bold;" data-mce-style="color: #333333; font-family: times new roman,new york,times,serif; font-weight: bold;"><br></span></span></div><div><br></div><div><span style="color: rgb(51, 51, 51); font-family: times new roman,new york,times,serif; font-weight: bold;" data-mce-style="color: #333333; font-family: times new roman,new york,times,serif; font-weight: bold;">Benoît </span><span style="color: rgb(51, 51, 51); font-family: times new roman,new york,times,serif; font-weight: bold;" data-mce-style="color: #333333; font-family: times new roman,new york,times,serif; font-weight: bold;"><br></span></div></div></div></body></html>