This is a less than completely useful error message; I got it when I 'ssh -X'ed to a Linux host form OSX and tried to 'sudo system-config-securitylevel'. Here's the actual message
X11 connection rejected because of wrong authentication. The application 'system-config-securitylevel.py' lost its connection to the display localhost:10.0; most likely the X server was shut down or you killed/destroyed the application.
A workaround is to do 'sudo xterm' and then 'mkxauth -m username' and then do the 'system-config-securitylevel'.
I don't have a clue as to why and don't have time to figure it out...
Update: a better approach is probably "sudo -- sh -c 'mkxauth -m beaty; command"
Another update: under debian "xauth merge /home/beaty/.Xauthority"