System user shifting

I have noticed that some of the system user is “shifting” from time to time. I have enabled navidrome service and have /var/lib/navidrome preserved by preservation with user and group both set to navidrome. From time to time, the /var/lib/navidrome directory and some of its subdirectories and files and have their user changed to something else and that leads to navidrome service to fail. Since both the parent directory and some of the subdirectories get affected, I assume it is not the problem for perservation.

This also happens on another machine. On that machine, I have setup a system user syncoid manually and then I run the command zfs allow -u syncoid send,hold,mount <dataset> for syncoid syncing. But after sometime I found that the allowed user has changed from syncoid to sshd.

This confuses me as I have to manually change back the shifted user. Why is this happening and any way to solve it?

Thanks.

Do you have /var/lib/nixos preserved?

Yes, I have that preserved.

It sounds like the UIDs/GIDs on your system are being remapped. make sure /var/lib/nixos/uid-map and /var/lib/nixos/gid-map are being preserved. consider backing these up and next time you notice the users shifting, compare the maps to see what’s going on.