'How to change user/group uid/gid in LXC container and affecting the used files/directorys

In a fresh Debian 11 container I installed urbackup. In the container the uid/gid from urbackup is 107/115. I needed to bind mounted a zfs dataset to store the actual backups.. Therefore I changed in lxc the urbackup user/group.

root@urBackup:~# usermod -u 1005 urbackup 
root@urBackup:~# groupmod -g 1005 urbackup

It seems though that some directory's stil had old uid/gid

root@urBackup:~# ls -al /var/urbackup
total 108012
drwxr-xr-x  3 nobody     115     4096 Apr 19 05:54 .
drwxr-xr-x 12 root   root        4096 Apr 19 05:46 ..
-rwxr-x---  1 nobody     115 35044777 Apr 19 05:47 UrBackupUpdate.exe
-rwxr-x---  1 nobody     115       40 Apr 19 05:47 UrBackupUpdate.sig
-rwxr-x---  1 nobody     115      102 Apr 19 05:47 UrBackupUpdata.sig2

Is there a easy way to change also the directory's and files belonging to a certain user/group.

Thanks for reading Guy



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source