Search code examples
filepermissionsrsynclxc

Some random ownership changes through `rsync -a` inside a LXC container


I am migrating a dedicated server running Debian 12 with LXC and a couple of containers.

I use rsync with -avhze options from the new server (pulling), with root user on both sides.

It appears that inside a container, the owner and group have changed on 2 mysql folders :

Old server :

root@myOriginalContainer:/# ls /var/lib
drwx--S---  7 mysql   mysql 4,0K 10 juil. 18:10 mysql/
drwx------  2 mysql   mysql 4,0K  4 juin   2017 mysql-files/

New server :

root@myRsyncedContainer:/# ls /var/lib
drwx--S---  7 996   polkitd 4,0K 10 juil. 18:10 mysql/
drwx------  2 996   polkitd 4,0K  4 juin   2017 mysql-files/

I checked with less /etc/passwd that the users are identical in both copies of the container : same names and numerical ID's.

Edit2 : polkitd debian package may be the culprit, but I am not able to understand how.

Edit3 : OK, it is a LXC mapping issue. I need to look into this, any help appreciated!

So my questions are :

  • How is it possible ? And who's fault is that ? (rsync, mariadb less likely, other ?)
  • What is the good way to solve this ?
  • Which other files may be affected ? How could I check this "container-widely" if necessary ?

Thanks in advance for any tip!


Solution

  • The solution isn't completely satisfactory: I've just given up trying to figure out how to handle it with lxc, and chown the necessary folders inside the new container.

    I'm still interested in a more consistent answer.