# "xterm: Xt error: Can't open display: localhost:0"



## hruodr (Jul 2, 2017)

I get the above error, when I do  `xterm -display localhost:0`.

I get similar error, when I try to open a remote xterm.

I start X11 with `xinit` as a normal user. And yes, I did before `xhost +`.

Why? Why?! 

As I remember, it was never a problem to use X11 as a server.


----------



## hruodr (Jul 2, 2017)

Someone changed the rules of the game, and I wasted a lot of time due to it.

In Xorg() manual page you still read:

           Xorg listens on port 6000+n, where n is the display number.  This
           connection type can be disabled with the -nolisten option (see the
           Xserver(1) man page for details).

This is not anymore true. You need `-listen tcp` in order that Xorg listen tcp connections.

The solution to my problem above is a file .xserverrc in the home directory containing a line `exec Xorg -listen tcp`.

Just xinit() manual pages.


----------



## SirDice (Jul 3, 2017)

I'm not sure when exactly it happened but the default changed from default open to default closed. Most people don't require it and security-wise it makes sense to close the port by default.


----------

