SSH -X "Warning: untrusted X11 forwarding setup failed: xauth key data not generated"

sprw121 picture sprw121 · Dec 9, 2014 · Viewed 81.5k times · Source

Hey I'm having an issue getting ssh X forwarding to work. The setup is I'm sshing into my ubuntu VM off OSX Yosemite host machine.

I already installed xQuartz on OSX, xauth on ubuntu, and I believe I've have all the correct options set in ssh_config files.

I get the

Warning: untrusted X11 forwarding setup failed: xauth key data not generated
X11 forwarding request failed on channel 0

message when opening a connection with ssh -X, and when I tried to run an X application:

xterm: Xt error: Can't open display:
xterm: DISPLAY is not set

I have the identical setup on my other machine except running Mavericks and it works fine, is there something specific to Yosemite specific I have to worry about?

Answer

Koko picture Koko · Jan 31, 2018

Note that some incomplete answers might lead to security flaws.

  1. Using ssh -Y means here having fake xauth information which is bad!
  2. ssh -X should work since XQuartz, once enabled, uses xauth. The only problem is that ssh is looking for xauth in /usr/X11R6/bin and on macOS with XQuartz it is in /opt/X11/bin

Secure solution:

  1. Enable the first option in the Security tab of preferences (Cmd-,) which enables authenticated connections.

  2. Edit ~/.ssh/config, add XAuthLocation /opt/X11/bin/xauth to the host config.

  3. ssh -X your_server works in a secure manner.

  4. Ensure xauth is installed on the destination host.