Change UID/GID of backups user

ljon_pve

New Member
Feb 5, 2025
3
0
1
I'm currently using PBS over NFS ( I know people don't like this setup, but it's a homelab and the performance is excellent for my uses ) with a Unifi UNAS Pro 8. Problem is, the UNAS doesn't support no_root_squash, so the best way I've found to handle this is to manually edit the NFS exports on UNAS to set anonuid/anongid to match with the backups user on PBS. This causes other problems, like the UNAS being unable to sync my offsite backups.

The TLDR; here is that it would be great if I could just change the UID/GID of the backups user on PBS to match the built-in user on the UNAS, but I'm not sure if the system would just keel over if I did that. Is there a way to change the UID/GID of the backups user? I can make it work if not, but it sure would make life easier if I could.
 
Hey,

that is not really possible, at least not intended.

Caution, the following is not recommend, supported or tested:
Technically we use [1] to get the UID/GID to check for, soo you could change the UID/GID of the backup user and group. But then you'd also have to change the owner of a lot of files, namely
Code:
# all files
find / -uid 34

# update uid/gid
find / -uid 34 -print0 | xargs -0 chown <NEW_UID>:<NEW_GID>
For changing the IDs you could use
Code:
usermod -u <NEW_UID> backup
groupmod -g <NEW_GID> backup

# check if updated
cat /etc/passwd | grep backup
cat /etc/group | grep backup
When doing this stop the pbs services, and afterwards reboot the system.
Test this in a VM! Also (file-)restoring, as said above, I did not test this. Try at your own discretion.


[1] https://git.proxmox.com/?p=proxmox-...ad6bfb17522e6b0e4edf;hb=refs/heads/master#l31
 
Not that I'm recommending anyone else to do this, but FWIW, the above advice did work. I already run PBS in PVE, just use it as basically a proxy to NFS that adds differential backups. Cloned the VM and tried the above.

It failed initially, as it couldn't read some key files in /etc/proxmox but it worked after running
find / -gid 34 -print0 | xargs -0 chgrp <NEW_GID>

Corrected permissions on all the files stored in UNAS, and tested a restore - works great. Thanks so much for the help! I knew what to do, but never would have been brave enough to try it without the suggestion that it actually had a shot at working.


For anyone else looking to setup a UniFi UNAS Pro w/ PBS over NFS, here's what I did. Recommend doing this before setting up a datastore or mounting NFS drives.

Bash:
service proxmox-backup stop && service proxmox-backup-banner stop && service proxmox-backup-proxy stop
find / -uid 34 -print0 | xargs -0 chown 977:988
find / -gid 34 -print0 | xargs -0 chgrp 988
usermod -u 977 backup
groupmod -g 988 backup
service proxmox-backup start && service proxmox-backup-banner start && service proxmox-backup-proxy start