When I connect to a remote host (running darwin) with PuTTY, and having Xming running alongside, I can run, e.g., xlogo on the remote host, and I see the appropriate xlogo display clientside.

But once I fire up GNU screen on the remote host, this test no longer works. E.g. my xlogo command now fails with:

Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
Error: Can't open display: localhost:10.0

(Note that localhost:10.0 is indeed the correct value for DISPLAY.)

Is it possible to get X11 with this setup? If so, please let me know how.


PS: FWIW, in PuTTY, my settings for Connection > SSH > X11 are:

  • Enable X11 forwarding is CHECKED
  • X display location is BLANK
  • Remote X11 authentication protocol is set to MIT-Magic-Cookie-1

(Let me know if I should post any other settings.)


I was actually trying to learn the basics of X11 via PuTTY last week. I came across a nice tutorial. To be perfectly honest, as this was my first foray into X11, I didn't necessarily absorb all of the info. I did, however, get everything working by following along.

There is a section on this page that dives into creating and configuring those magic cookies and setting up to use Xauth.

On the same page there, it also goes into some detail about Xhost, as @arved mentioned. The relatively short section is quoted below...

Xhost allows access based on hostnames. The server maintains a list of hosts which are allowed to connect to it. It can also disable host checking entirely. Beware: this means no checks are done, so every host may connect!

You can control the server's host list with the xhost program. To use this mechanism in the previous example, do:

light$ xhost +dark.matt.er This allows all connections from host dark.matt.er. As soon as your X client has made its connection and displays a window, for safety, revoke permissions for more connections with:

light$ xhost -dark.matt.er You can disable host checking with:

light$ xhost + This disables host access checking and thus allows everyone to connect. You should never do this on a network on which you don't trust all users (such as Internet). You can re-enable host checking with:

light$ xhost - xhost - by itself does not remove all hosts from the access list (that would be quite useless - you wouldn't be able to connect from anywhere, not even your local host).

Xhost is a very insecure mechanism. It does not distinguish between different users on the remote host. Also, hostnames (addresses actually) can be spoofed. This is bad if you're on an untrusted network (for instance already with dialup PPP access to Internet).


checkout the xhost(1) manpage for giving access control to your screen session

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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