MobaXterm X11 proxy: Authorisation not recognised
The GUI app actual crashed with this error and not showing up on client desktop. Here's the solution:
From your MobaXTerm SSH client console after login:
$ $ sudo xauth add $(xauth -f /home/[USER]/.Xauthority list|tail -1) $
According to mobatek's blog,
We receive a lot of emails asking how to keep X11-forwarding working after changing user to root inside a SSH session in MobaXterm. This is by default not allowed on Unix/Linux systems, because the X11 display connection belongs to the user you used to log with when connecting to your remote SSH server. X11-forwarding mechanism does not allow anyone to use the open display.The single line of command helps solving problems whenever you need to have a working X11 display through SSH after becoming root.
However, in some cases you may need to start a graphical application like nedit or firefox in a sudo or su context. In order to achieve this, you could manually retrieve X credentials in the su/sudo context by looking up the “xauth list” for the original username and then adding them using “xauth add” to the current context.
You can also use a single (magic) command in order to achieve this!
Update:
The aforementioned method would not survive another SSH login as MIT-MAGIC-COOKIE always changes during user login. The cookie previously copied to ROOT account will become obsolete.
To permanently resolve this, we need root privilege to ADD the following statement to the end of the file /etc/sudoers:
# Defaults env_keep += "XAUTHORITY" #
This is enough to allow sudo opening Xorg program. Also, env_keep actually points to environment variable "XAUTHORITY" which is the location of .Xauthority. So you may add the following EXPORT statement to ~/.bashrc or set it globally in the file /etc/environment (CentOS 7)
# EXPORT XAUTHORITY=/home/[YOUR_USERNAME]/.Xauthority #
This method ensure that remote sudo opening works even after next SSH login or SSH server reboot.