X11 Forwarding Refused
When starting an SSH session, if you get the error Cannot Open Display in X-Win32’s status window, the remote host may not have X11 Forwarding (or X11 Tunneling) enabled. SSH sessions use X11 Forwarding by default to connect the remote X Client (e.g. xterm, konsole, mozilla, firefox, dtterm, gnome-terminal, etc.) back to X-Win32.
To fix this problem you need to enable X11 forwarding on your remote ssh server (or sshd, typically OpenSSH):
- Find your sshd_config file
- For OpenSSH on Linux, this is typically located at /etc/ssh/sshd_config (note: this is not the same as /etc/ssh/ssh_config, which is used for configuring the ssh client settings)
- Read the man page for sshd_config, which may specify the location of the file (run man sshd_config)
- If you still cannot find the file, run find / -maxdepth 3 -name sshd_config to try to find it
- Edit the file as root
- Find the line
X11Forwarding no
or the line
#X11Forwarding no
- Change the line to
X11Forwarding yes
-
- Save the file
- Restart sshd You can enable X11 Forwarding on an individual user basis.
- Create or Edit the $HOME/.ssh/config file
- Add the line
ForwardX11 yes
Additional Information (error: Failed to allocate internet-domain X11 display socket.)
An “error: Failed to allocate internet-domain X11 display socket.” may occur after enabling X11 forwarding.
To resolve this error:
- Edit your sshd_config file again
- Find the line
#AddressFamily any
- Change the line to
AddressFamily inet
- Save File
- Restart sshd
- Find the line