I never use Caps Lock, so I disable the Caps Lock key completely with xmodmap, to avoid hitting it by accident.

Occasionally my X server gets into caps-lock state anyway. (Usually some complicated stunt was involved, like attaching x11vnc to the display remotely.) And then I can't turn it off again using the Caps Lock key.

So I wrote a tiny X client that lets me type 'xcapslock off' at a shell prompt …

… and then I had to make an alias to it, called 'XCAPSLOCK OFF'.

@simontatham interesting, I’ve never seen that in over 20 capslockless years… but I don’t attach x11vnc.

If you just need "a" remote seesion but not necessarily attach to th currently running session, I can recommend xrdp+xorgxrdp on the server side, and rdesktop or some other RDP client to connect. It also has keymap issues, but slight (basically, I need to revert to the default US layout without my customisations outside if I want to use similar xmodmap effects inside, and inside it uses the older XFree86 / pre-evdev Xorg keycodes).