Making Conflicting UIDs across a LAN of MacOS and Linux hosts Consistent I have an expanding network and while I have the long term goal of eventually implementing Active Directory hosted on a QNAP NAS. However, in the meantime I have the issue of where my MacOS machines have one set of UIDs for the 2 or 3 users I use while my Linux machine have another.

I learned that in Mojave you need to use dscl to change attributes like UID but I am not sure how I can set the UID scheme for new users to make the new Unix and MacOS accounts more easily line up going forward. While I envision Active Directory making this moot once its in place, I presume I must get my LANs UIDs and GUIDs under control first.
Aside from doing all of this manually by using tools like find and chown manually, are there tools for migrating to AD where normalizing UIDs for the same users across different hosts can be better automated and a reliable process with less risk of breakage? If not, I am pretty sure I know what I need to do and it will be gritting my teeth, but at least I know what it's going to take. If you have any suggestions that might make this easier and less dangerous please share your thoughts! For instance, I presume that no user should have it's UID changed while logged in, yes? Anwyay I welcome all thoughts and ideas!
I used this procedure to change uid's on macOS Tiger and Ubuntu. The info on passwords has changed. 


  Ok, so how can I check my UID? I've heard that it's dangerous to
  change the UID, so how should I do if I want the permissions to work
  in both OSes?


You can change the permissions of files and directories in either OS.

I suggest that you make a complete backup of your system.  You should create a second administrator account from which you use to change your original account.  You should log out your original account before proceeding.

Mac OS X ... harddrive -> Applications -> Utilities -> terminal

Ubuntu ... Applications > Accessories > Terminal
or where ever the Terminal is today. 

Your current user is:
echo $USER
Let's assume myuser

To find out your UID and GID do:

ls -ln
ls -l


Or, you can use the id command.

id


compare the output and write down what you find.

You best use the numeric value for your userid.  In this case it is 500.  To list all the files owned by a userid do:

sudo find / -user 500 -exec ls {} \;


adding a -x before the / limits the search to the current file system.

You need to adjust the uid and gid in your account definition. 

In the Ubuntu terminal,

man 5 passwd  


... will give you the format of the passwd file.

sudo nano /etc/passwd


... the format is user-name, password, uid, gid, ...

control-o
  ... to save
control-x
  ... to quit

The groups are defined in /etc/group

cat /etc/group


Now change the UID and GID of all files:
You best use the numeric value for your userid.  In this case it is 500.

sudo find / -user 500 -exec chown 1100:211 {} \;

/* Where chown has the format of chown uid:gid file-name */
/* adding -print before -exec lists the files that will be changed. */
/* You may want to leave off :211 if your uid &amp; gid are not paired. */
/* Notice the -exec runs another command on the found file. */

sudo find / -group 20 -exec chgrp 211 {} \;


On the Mac you get into single user mode by holding down command-s when you poweron your machine. Just in case you run into problems.

On Mac OS, there are a few files that have the old uid as part of their name.  The .Trashes file will be used on removal media. Here are other directories. 

/.Trashes/500
/Library/Caches/com.apple.IntlDataCache.500
/Library/Caches/com.apple.IntlDataCache.sbdl.500
/Library/Caches/com.apple.user500pictureCache.tiff


You will need to look on the external drives. All the trash is in a common folder with uid based subfolders. You can use the find command to do a search:

find -x /  -iname "*500*" 


Be patient.  You can quit this command with a control-c 

It similar in Linux, but based on the short user name.

On Linux, there are a few files that have the old user short name as part of their file and folder names.

Should some of the files be locked on macOS, you will need to unlock them. See  – Darf Nader comments below. The macOS lock flag corresponds to the Unix layer uchg flag. 

#To display flags:
ls -lO &lt;filename&gt;
#Turn off the lock:
sudo chflags nouchg 




Here is another explanation of the procedure. ( It misses some files because the author checks only the most likely places.
http://lissot.net/netinfo/change_user.html

Robert