"Synchronizing" users and groups between servers


#1

My setup:

Desktop PC running Manjaro
Server1 running Ubuntu Server 16.04
Server2 running Ubuntu Server 18.04

Server1 is my trusty old box. Among other tasks it runs Deluge for some torrenting. Torrents are downloaded to /mnt/data/torrents which is owned by deluge:deluge

Server1 is running low on space so I’ve copied /mnt/data/torrents to /mnt/data/torrents on my new server2.

On server2 I’ve created user deluge and given ownership of /mnt/data/torrents to deluge:deluge

On server1 I’ve renamed /mnt/data/torrents to /mnt/data/torrents.backup and then I’ve mounted server2:/mnt/data/torrents as /mnt/data/torrents on server1

On my desktop pc I’ve also mounted server2:/mnt/data/torrents

If I do an ls -l of torrents on server2 it says 755 deluge:deluge

If I do an ls -l of torrents on server1 it says 755 vboxuser:1001

If I do an ls -l on my desktop pc is says 755 1001:thomas

If I look at /etc/passwd on the 3 systems it makes sense when comparing user numbers and group numbers only they don’t agree on which users those numbers belong to.

I’m a bit of a loss on how to fix it other than doing a chmod 777 and ignore the differences.


#2

UIDs and GIDs are stored as numeric and then mapped to an alphanumeric value via /etc/passwd and /etc/group.

If you want to synchronise these between machines then you need to ensure the mapping is consistent, i.e. the same numeric UID has the same username.

Essentially, you have to edit the UIDs and GIDs on each machine so that they match.

You can do this by hand by editing the files, or by using usermod.


#3

Thanks man, got it to work. Now I just need to get the deluge daemon to play nice.