All,
I'm trying to set up SSH X11 forwarding from a NetBSD 8.2 VM (running via QEMU) to a Ubuntu 20.04 host. When I attempt to ssh -X into the machine, the $DISPLAY variable is not set and I get an error message: "X11 forwarding request failed on channel 0". The following are pertinent environment details:
xauthis installed on the NetBSD 8.2 VM and it works properly- I have the line
ForwardX11 yesin the/etc/ssh/ssh_configfile on both NetBSD as well as the Ubuntu host - I have the line
XAuthLocation /usr/X711/bin/xauthin thessh_configfile on NetBSD.
If I run ssh -v, then the relevant X11 output I get is the following:
Authenticated to localhost ([127.0.0.1]:10022).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
X11 forwarding request failed on channel 0
what could be possible reasons for this?
X11 forwarding is disabled by default both in the
sshclient and in thesshdserver. The setting that controls it in the client is calledForwardX11, and the setting in the server is calledX11Forwarding.When connecting from the Ubuntu machine to the NetBSD machine using
ssh, the following configuration files are being used:sshclient (Ubuntu machine)~/.ssh/config/etc/ssh/ssh_configsshdserver (NetBSD machine)/etc/ssh/sshd_configWith the
ssh(1)client, however, you could just use the-Xswitch instead of editing any of the client configuration files. In fact, I would highly recommend using the-Xswitch over enabling X11 forwarding for all hosts (i.e. in aHost *block like I'm showing below).If you do want to edit the
sshclient configuration, thessh_config(5)settings are the ones you already noted:The default for
XauthLocationis already/usr/bin/xauthon Ubuntu, so there should be no need to specify it, unless you have anotherxauthprogram installed in another location and you want to use it withssh.The
sshd(8)server on the NetBSD machine also has to allow X11 forwarding. Thesesshd_config(5)settings are the ones you still need to change:Again, the default for
XAuthLocationis already/usr/X11R6/bin/xauthon NetBSD 8.2, so there should be no need to specify it.After changing the
sshd_configsettings, you also need to restart thesshdservice (as the root user):