SSH X11 stuck for a long time

sshx11x11forwarding

I routinely run a bunch of experiments (perl scripts) on my lab machines.
The client machine I'm currently running my experiments on runs Ubuntu 14.04.5 LTS.

These perl scripts, among other things, ssh over to other machines on the network to gather network/vmstats. These have been working fine, until a recent update (on the client side) broke something, causing the scripts to run exceptionally slowly, with the following error message generated for every ssh command in the script :

Warning: No xauth data; using fake authentication data for X11 forwarding.

When I turned on -vvv level logging on my ssh commands, they reveal the following :

debug1: Entering interactive session.
debug2: callback start
debug2: x11_get_proto: /usr/bin/xauth  list unix:10.0 2>/dev/null
***[HANGS FOR 20-30 SECONDS]***
Warning: No xauth data; using fake authentication data for X11 forwarding.

I read all the SO and other forums' discussions I could find related to "interactive session slow" and the xauth warning, but none of the solutions really worked.

I also doubt any of those specific situations apply to me, mainly because I am able to get an ssh session going from the client machine to the server without any problems – it is the ssh's from the perl scripts which have the issue.

I checked the DISPLAY env variable, and it's passing it on correctly to the X11 server (here's the output):

echo $DISPLAY
localhost:10.0

xauth is working as well. I created a toy perl script invoked from inside a shell script (to try and simulate what's happening in my lab experiments), and this runs fine with no issues. Here are my toy scripts:

mary.sh
   #!/bin/sh
   printenv
   test.pl | & tee STDOUT-MARY
test.pl
   !/usr/bin/perl
   system "ssh -vvv <serverIP> 'cat vmstat.log' >> vmstat.mary < /dev/null\n";

Here are things I have also tried (suggestions from SO etc. discussions):

  1. Adding DISPLAY to the Acceptenv list in /etc/ssh/sshd_config
  2. Remove MOTD from /etc/pam.d/login and sshd files
  3. Remove landscape-client

I am totally clueless as to why this is happening, and how I can fix it. My lab experiments are running a lot longer than they should because of this issue. Any help on this is greatly appreciated. If you should need any more information to diagnose the issue, I am happy to provide it.

Thanks.

Best Answer

Try using ssh -Y

ssh man page

-Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.