SSH to NetBSD 8.2 guest with X11 gives X11 forwarding request failed on channel 0
X11 forwarding is disabled by default both in the ssh
client and in the sshd
server. The setting that controls it in the client is called ForwardX11
, and the setting in the server is called X11Forwarding
.
When connecting from the Ubuntu machine to the NetBSD machine using ssh
, the following configuration files are being used:
- On the
ssh
client (Ubuntu machine)~/.ssh/config
/etc/ssh/ssh_config
- On the
sshd
server (NetBSD machine)/etc/ssh/sshd_config
With the ssh(1)
client, however, you could just use the -X
switch instead of editing any of the client configuration files. In fact, I would highly recommend using the -X
switch over enabling X11 forwarding for all hosts (i.e. in a Host *
block like I'm showing below).
If you do want to edit the ssh
client configuration, the ssh_config(5)
settings are the ones you already noted:
Host *
ForwardX11 yes
XauthLocation /usr/bin/xauth
The default for XauthLocation
is already /usr/bin/xauth
on Ubuntu, so there should be no need to specify it, unless you have another xauth
program installed in another location and you want to use it with ssh
.
The sshd(8)
server on the NetBSD machine also has to allow X11 forwarding. These sshd_config(5)
settings are the ones you still need to change:
X11Forwarding yes
XAuthLocation /usr/X11R6/bin/xauth
Again, the default for XAuthLocation
is already /usr/X11R6/bin/xauth
on NetBSD 8.2, so there should be no need to specify it.
After changing the sshd_config
settings, you also need to restart the sshd
service (as the root user):
service sshd restart
X11 Forwarding Error on Ubuntu, Though It Works On Windows
I solved it - it was an authentication issue. Executing the following line on Server resolved the issue:
$ xauth add ${client_ip}:0 . ${hex_key}
xauth: creating new authority file /homes/${username}/.Xauthority
where ${client_ip}
is the client with X server running, ${hex_key}
is the 32-character hex string. Afterwards upon assinging the $DISPLAY
env variable I can now connect successfully.
Related Topics
Permission Denied Error When Running Crontab
Awk - Count Each Unique Value and Match Values Between Two Files
How to Use "Py" Instead of "Python" at the Command Line in Linux
How to Make a Built-In Device Driver in Linux
I Want to Contribute to the Linux Kernel
Preserve Colouring After Piping Grep to Grep
Installing Node.Js on Debian 6.0
Bash - Find Files Older Than X Minutes and Move Them
How to Grep One String Occuring Multiple Times from Same File
How to Write Multiple Line String Using Bash with Variables
How to Edit a Binary File on Unix Systems
How to Include File in a Bash Shell Script
Comparing Two Unsorted Lists in Linux, Listing the Unique in the Second File
How to Get the Current Network Interface Throughput Statistics on Linux/Unix
How to Configure Curl to Only Show Percentage
Linux Makefile Structure and Documentation