Setting UID and GID for shared folder using NFS method in Linux system

Hi everyone,
have a good day to you.

I am trying to use NFS to share a folder between 2 linux systems.
Let's say the server which is sharing the folder is server A and the client which need to access this shared folder is server B.
In server B, i am having a Joe user which UID and GID is 500. Joe user does not exist on server A. The purpose: Joe user must be the owner of shared folder from server A on server B.

From the exports man page, I can see that we have the option for User ID Mapping by setting the following in /etc/exports on server A:
/etc/shared <Server B IP Address>(rw,all_squash,anonuid=500,anongid=500)

However, when I execute the mount command on server B to mount the shared folder to a mount point, I do not get the UID and GID of Joe. Instead, I am getting root which is the same as this folder on server A.

Is there anything that I am missing here? Please suggests.

Regards,
Michael

Hi, can't you make user Joe known on server A ? With this approach you remove security and make everyone uid 500 with gid 500 when writing or reading from the NFS share.

That said, for this to even work, it seems to me the export should be reversed, so server B should export to server A.