Mapping UID and GID of local user to the mounted NFS share
Solution 1:
This is what idmapping is suppose to do. First of all, enable is on the client and server:
# echo N > /sys/module/nfs/parameters/nfs4_disable_idmapping
clean idmap cache and restart idmap daemon:
# nfsidmap -c
# service rpcidmapd restart
Now on server and the client will send instead of numeric IDs string principals like [email protected]. You need to have bob account on the both hosts - client and server. Nevertheless, the numeric ID's can be different.
Solution 2:
You have all the pieces there. From the exportfs man page, all_squash
maps all uids and gids to the anonymous versions. What you wrote forced those values to be 512. If you changed to 1000, the nfs server on the remote host would make everything 1000, and access should be granted.