Skip to content

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):

  1. Find your sshd_config file
    1. 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)
    2. Read the man page for sshd_config, which may specify the location of the file (run man sshd_config)
    3. If you still cannot find the file, run find / -maxdepth 3 -name sshd_config to try to find it
    4. Edit the file as root
    5. Find the line
      • X11Forwarding no
      • or the line
      • #X11Forwarding no
    6. Change the line to
      • X11Forwarding yes
    7. Save the file
  2. Restart sshd You can enable X11 Forwarding on an individual user basis.
  3. Create or Edit the $HOME/.ssh/config file
  4. 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:

  1. Edit your sshd_config file again
    1. Find the line
      • #AddressFamily any
    2. Change the line to
      • AddressFamily inet
    3. Save File
    4. Restart sshd