When I run vncserver
command it will create session with display as :1
,and in the terminal when we check the display variable, it is set as DISPLAY=:1
, Is it possible to create a vnc session with display variable set as DISPLAY=hostname:1
, I know to change the display variable by using export
or setenv
command depending on the shell, But if I change the display variable manually to hostname:1
, xhost
command doesn't work as the vnc session is originally created for :1
only,
Am not sure why this behavior or is this the default behavior?
Am using Solaris 11.4 OS
You're misunderstanding how X Windows
DISPLAY
environment variables work.Per the X.org documentation (bolding mine):
From the X server process, there is no
hostname
part of a display name - the server is running on the system it's running on.So setting an X server to run on
hostname:1
is no different than setting it to run on:1
.For X Windows client programs, though, the
hostname
part of aDISPLAY
environment variable denotes the system where the display they need to connect to is running. In other words, the connect becomes a network connection.When your
xterm
process is started locally, it connects to the local X server process by default, denoted with:1
(or:0
or:0.0
or:2.0
...). SettingDISPLAY=hostname:1
means the X client process will try to perform a network connection to the:1
display, running on thehostname
system. And if the X server process isn't configured to listen for network connections in addition to local connections, or if there's a firewall in the way, that client process will fail to connect tohostname:1
.So just using the
xhost
command to enable remote access won't work if the X server isn't configure to allow such access.For the
:1
display, if your X server is configured to allow remote access, runningnetstat -an | grep 6001
will produce output something like this:If you do not see any process with
LISTEN
on port 6001, the X server for your:1
display is not configured to accept remote connections.