Making Conflicting UIDs across a LAN of MacOS and Linux hosts Consistent
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