I am trying to access Raspberry Pi from any host, but every time I type xhost +, this error comes onto the screen:

PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xhost:  unable to open display "localhost:10.0"

I am using PuTTY and X11 forwarding is enabled that is under SSH > X11.

Edit: I am using Win Machine.

  • Do you have X server installed on your Win Machine?
    – Jakuje
    Aug 16, 2016 at 14:24
  • @Jakuje Yes Sir
    – Tes3awy
    Aug 16, 2016 at 16:12

3 Answers 3


Seems like the same question has been asked in Unix and Linux. https://unix.stackexchange.com/questions/202043/putty-cygwinx-and-x11-forwarding-connection-refused.

By default CygwinX no longer listens for tcp connections (Cyg SSH is using Unix sockets to connect). To enable tcp connections "-listen tcp" needs to be added to the command line parameters. In my case I changed the "XWin Server" icon to read:"

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin -- -multiwindow -listen tcp"

From the answer that works for me: https://unix.stackexchange.com/questions/202043/putty-cygwinx-and-x11-forwarding-connection-refused#answer-202256


If anybody runs into this problem, i had an issue with this,

The OP mentioned using Putty, this normally insinuates Windows, however there is other ways that the following info may be useful for other systems:

  1. Check to make sure chosen X-Server has been started on your client box. For example if you have XMing with windows, did you run XLaunch first? If not, you can do this, but before you do that make sure you dont already have another xming server running (look in the systray).

  2. Next, to make sure its running correctly, look at your Xserver log log, and make sure it started successfully. If all this is done, i found that even with firewalls up, as long as you allowed it in the local client system firewall , your good.

  3. If you can get only one instance of your clients X-Server running, and dont see any errors in the log, this is when you attempt the connection, otherwise you will get the errors

PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused xhost: unable to open display "localhost:10.0"

Note: when you see the double digit display id, e.g. localhost:10.0, it denotes a remote server display id.

  1. Open the pam.d xserver file /etc/pam.d/xserver comment out the auth console line on the file /etc/pam.d/xserver, then restart, then retest.

  2. Make sure X-11 forwarding is enabled in Putty, save your putty session before connection after making this adjustment

  3. Once your in your terminal, simply run an x program, e.g. xterm or you can test with xhost +.

    $ xhost +
    access control disabled, clients can connect from any host

Don't test with startx, it should already be started.

Pro tip: In xming, once you get it working, you can save a config file, then just use this config file to launch each time, once you get it working, so that you will have no further issues.


Change the display in Putty to "localhost:0", that should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.