Although it references connecting remotely, try following this guide from VMware:
If your keyboard works correctly with a local X server, and you just want the same behavior with a remote X server (which is also an XFree86 server running on a PC), just power off the virtual machine and close the VMware Workstation window, then add the line
xkeymap.usekeycodeMapIfXFree86 = true
to the virtual machine configuration file or to ~/.vmware/config. Make this change on the host machine, where you run the virtual machine, not on the machine with the remote X server.
If you are using an XFree86-based server that VMware Workstation does not recognize as an XFree86 server, use this instead:
xkeymap.usekeycodeMap = true
There is also a more detailed explanation which suggests the following:
Using a text editor to add configuration settings to the virtual machine's configuration file.
xkeymap.usekeycodeMapIfXFree86 = true
Use key code mapping if you are using an XFree86 server, even if it is remote.
xkeymap.usekeycodeMap = true
Always use key code mapping regardless of server type.
xkeymap.nokeycodeMap = true
Never use key code mapping.
xkeymap.keycode.<code> = <v-scan code>
If using key code mapping, map key code <code>
to <v-scan code>
. In this example, <code>
must be a decimal number and <v-scan code>
should be a C-syntax hexadecimal number (for example, 0x001).
The easiest way to find the X key code for a key is to run xev or xmodmap -pk. Most of the v-scan codes are covered in V-Scan Code Table. The keysym mapping tables described in this section are also helpful.