xshell Error: Unable to initialize gtk, is DISPLAY set properly?

下午想通过ssh连接服务器节点使用VTune,结果显示错误:xshell Error: Unable to initialize gtk, is DISPLAY set properly?

折腾了好长时间才解决,因此记录下做备忘。

排查错误的步骤:

1、检查服务器端是否允许X11Forwarding(/etc/ssh/sshd_config文件中“X11Forwarding=yes”);

2、检查$DISPLAY是否为本机的IP地址;

3、检查XShell是否允许X11Forwarding(http://www.netsarang.com/tutorial/xshell/1018/Using_X11_forwarding)。