How can I find the mapping on `$DISPLAY` after `ssh -X`?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
On machine B, I remote access machine C
$ ssh -X t@C
$ echo $DISPLAY
localhost:10.0
How can I find/verify the mapping of $DISPLAY
on C to $DISPLAY
on B? Can it be done by the following command on C?
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Why is the connection between $DISPLAY
on C and $DISPLAY
on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)? Why do I get more information about port 6010 in the following than before running the X client?
$ eog &
[1] 1129
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp 0 0 localhost:59782 localhost:6010 TIME_WAIT
tcp 0 0 localhost:59780 localhost:6010 ESTABLISHED
tcp 0 0 localhost:59778 localhost:6010 TIME_WAIT
tcp 0 0 localhost:6010 localhost:59780 ESTABLISHED
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Thanks.
ssh netstat xforwarding ss
add a comment |
On machine B, I remote access machine C
$ ssh -X t@C
$ echo $DISPLAY
localhost:10.0
How can I find/verify the mapping of $DISPLAY
on C to $DISPLAY
on B? Can it be done by the following command on C?
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Why is the connection between $DISPLAY
on C and $DISPLAY
on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)? Why do I get more information about port 6010 in the following than before running the X client?
$ eog &
[1] 1129
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp 0 0 localhost:59782 localhost:6010 TIME_WAIT
tcp 0 0 localhost:59780 localhost:6010 ESTABLISHED
tcp 0 0 localhost:59778 localhost:6010 TIME_WAIT
tcp 0 0 localhost:6010 localhost:59780 ESTABLISHED
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Thanks.
ssh netstat xforwarding ss
add a comment |
On machine B, I remote access machine C
$ ssh -X t@C
$ echo $DISPLAY
localhost:10.0
How can I find/verify the mapping of $DISPLAY
on C to $DISPLAY
on B? Can it be done by the following command on C?
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Why is the connection between $DISPLAY
on C and $DISPLAY
on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)? Why do I get more information about port 6010 in the following than before running the X client?
$ eog &
[1] 1129
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp 0 0 localhost:59782 localhost:6010 TIME_WAIT
tcp 0 0 localhost:59780 localhost:6010 ESTABLISHED
tcp 0 0 localhost:59778 localhost:6010 TIME_WAIT
tcp 0 0 localhost:6010 localhost:59780 ESTABLISHED
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Thanks.
ssh netstat xforwarding ss
On machine B, I remote access machine C
$ ssh -X t@C
$ echo $DISPLAY
localhost:10.0
How can I find/verify the mapping of $DISPLAY
on C to $DISPLAY
on B? Can it be done by the following command on C?
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Why is the connection between $DISPLAY
on C and $DISPLAY
on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)? Why do I get more information about port 6010 in the following than before running the X client?
$ eog &
[1] 1129
$ netstat -a | grep 6010
tcp 0 0 localhost:6010 0.0.0.0:* LISTEN
tcp 0 0 localhost:59782 localhost:6010 TIME_WAIT
tcp 0 0 localhost:59780 localhost:6010 ESTABLISHED
tcp 0 0 localhost:59778 localhost:6010 TIME_WAIT
tcp 0 0 localhost:6010 localhost:59780 ESTABLISHED
tcp6 0 0 ip6-localhost:6010 [::]:* LISTEN
Thanks.
ssh netstat xforwarding ss
ssh netstat xforwarding ss
asked Mar 15 at 12:02
TimTim
28.7k79269493
28.7k79269493
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
"the mapping of $DISPLAY on C to $DISPLAY on B" what does that mean?
Clearly you grep
out of something on C, so you only see sockets on C which involves "port num=6010". Other connection or listening socket on C are grep
out.
You didn't see any connection before because there hasn't been any X client running and connected to sshd(port number=6010), and more info after because you now run an X client, which has connected to your sshd(port num=6010).
You have to know the network topology when using SSH tunnel. SSH server on C opens a new socket which listen on port 6010 because it was asked to by the SSH client on B. The ssh tunnel is still established between SSH client on B and SSH server on C(port num=22, if sshd not specially configured), you don't see this tunnel connection since you grep
it out. X clients on C connects to sshd(port number=6010), then sshd multiplex these connections using the ssh tunnel and forward these connections to the X server on B.
"Connection between $DISPLAY on C and $DISPLAY on B" doesn't really exist, the ssh tunnel is created between C:22 and address_of_the_SSH_client_on_B. And since it's a connection, it's not possible in the LISTENING state.
use netstat -ap
without grep
to see more information.
All the connection we mentioned in this answer means real TCP connection, from the kernel's view, not "connections" from end-users' view.
add a comment |
Why is the connection between $DISPLAY on C and $DISPLAY on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
The X forwarding channel has not been yet created. It's only created when a client connects to the port 6010
on your C
(remote) machine. The connection will be forwarded as a separate channel through the ssh connection (not through a different tcp connection between C
and B
). To display all the channels forwarded through an ssh connection, you should use the ~#
escape at the beginning of a line:
$ ssh -X localhost
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
$ netstat | grep 6010
$ xterm &
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
#1 x11 (t4 r3 i0/0 o0/0 fd 8/8 cc -1)
$ netstat | grep 6010
tcp6 0 0 localhost:6010 localhost:39698 ESTABLISHED
tcp6 0 0 localhost:39698 localhost:6010 ESTABLISHED
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)?
I don't know any straighforward way to check that. I don't know about any X11 core protocol or extension request that returns the machine the X11 server runs on. You should do it step by step: first check if the X11 client is connected to a forwarder, then where it is forwarding the connection, etc.
Thanks. Whenever there is connection within the same host, is it always shown as two lines innestat
?
– Tim
Mar 15 at 21:26
Yes.netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.
– mosvy
Mar 15 at 22:08
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506488%2fhow-can-i-find-the-mapping-on-display-after-ssh-x%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
"the mapping of $DISPLAY on C to $DISPLAY on B" what does that mean?
Clearly you grep
out of something on C, so you only see sockets on C which involves "port num=6010". Other connection or listening socket on C are grep
out.
You didn't see any connection before because there hasn't been any X client running and connected to sshd(port number=6010), and more info after because you now run an X client, which has connected to your sshd(port num=6010).
You have to know the network topology when using SSH tunnel. SSH server on C opens a new socket which listen on port 6010 because it was asked to by the SSH client on B. The ssh tunnel is still established between SSH client on B and SSH server on C(port num=22, if sshd not specially configured), you don't see this tunnel connection since you grep
it out. X clients on C connects to sshd(port number=6010), then sshd multiplex these connections using the ssh tunnel and forward these connections to the X server on B.
"Connection between $DISPLAY on C and $DISPLAY on B" doesn't really exist, the ssh tunnel is created between C:22 and address_of_the_SSH_client_on_B. And since it's a connection, it's not possible in the LISTENING state.
use netstat -ap
without grep
to see more information.
All the connection we mentioned in this answer means real TCP connection, from the kernel's view, not "connections" from end-users' view.
add a comment |
"the mapping of $DISPLAY on C to $DISPLAY on B" what does that mean?
Clearly you grep
out of something on C, so you only see sockets on C which involves "port num=6010". Other connection or listening socket on C are grep
out.
You didn't see any connection before because there hasn't been any X client running and connected to sshd(port number=6010), and more info after because you now run an X client, which has connected to your sshd(port num=6010).
You have to know the network topology when using SSH tunnel. SSH server on C opens a new socket which listen on port 6010 because it was asked to by the SSH client on B. The ssh tunnel is still established between SSH client on B and SSH server on C(port num=22, if sshd not specially configured), you don't see this tunnel connection since you grep
it out. X clients on C connects to sshd(port number=6010), then sshd multiplex these connections using the ssh tunnel and forward these connections to the X server on B.
"Connection between $DISPLAY on C and $DISPLAY on B" doesn't really exist, the ssh tunnel is created between C:22 and address_of_the_SSH_client_on_B. And since it's a connection, it's not possible in the LISTENING state.
use netstat -ap
without grep
to see more information.
All the connection we mentioned in this answer means real TCP connection, from the kernel's view, not "connections" from end-users' view.
add a comment |
"the mapping of $DISPLAY on C to $DISPLAY on B" what does that mean?
Clearly you grep
out of something on C, so you only see sockets on C which involves "port num=6010". Other connection or listening socket on C are grep
out.
You didn't see any connection before because there hasn't been any X client running and connected to sshd(port number=6010), and more info after because you now run an X client, which has connected to your sshd(port num=6010).
You have to know the network topology when using SSH tunnel. SSH server on C opens a new socket which listen on port 6010 because it was asked to by the SSH client on B. The ssh tunnel is still established between SSH client on B and SSH server on C(port num=22, if sshd not specially configured), you don't see this tunnel connection since you grep
it out. X clients on C connects to sshd(port number=6010), then sshd multiplex these connections using the ssh tunnel and forward these connections to the X server on B.
"Connection between $DISPLAY on C and $DISPLAY on B" doesn't really exist, the ssh tunnel is created between C:22 and address_of_the_SSH_client_on_B. And since it's a connection, it's not possible in the LISTENING state.
use netstat -ap
without grep
to see more information.
All the connection we mentioned in this answer means real TCP connection, from the kernel's view, not "connections" from end-users' view.
"the mapping of $DISPLAY on C to $DISPLAY on B" what does that mean?
Clearly you grep
out of something on C, so you only see sockets on C which involves "port num=6010". Other connection or listening socket on C are grep
out.
You didn't see any connection before because there hasn't been any X client running and connected to sshd(port number=6010), and more info after because you now run an X client, which has connected to your sshd(port num=6010).
You have to know the network topology when using SSH tunnel. SSH server on C opens a new socket which listen on port 6010 because it was asked to by the SSH client on B. The ssh tunnel is still established between SSH client on B and SSH server on C(port num=22, if sshd not specially configured), you don't see this tunnel connection since you grep
it out. X clients on C connects to sshd(port number=6010), then sshd multiplex these connections using the ssh tunnel and forward these connections to the X server on B.
"Connection between $DISPLAY on C and $DISPLAY on B" doesn't really exist, the ssh tunnel is created between C:22 and address_of_the_SSH_client_on_B. And since it's a connection, it's not possible in the LISTENING state.
use netstat -ap
without grep
to see more information.
All the connection we mentioned in this answer means real TCP connection, from the kernel's view, not "connections" from end-users' view.
edited Mar 15 at 14:35
answered Mar 15 at 13:32
炸鱼薯条德里克炸鱼薯条德里克
6021317
6021317
add a comment |
add a comment |
Why is the connection between $DISPLAY on C and $DISPLAY on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
The X forwarding channel has not been yet created. It's only created when a client connects to the port 6010
on your C
(remote) machine. The connection will be forwarded as a separate channel through the ssh connection (not through a different tcp connection between C
and B
). To display all the channels forwarded through an ssh connection, you should use the ~#
escape at the beginning of a line:
$ ssh -X localhost
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
$ netstat | grep 6010
$ xterm &
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
#1 x11 (t4 r3 i0/0 o0/0 fd 8/8 cc -1)
$ netstat | grep 6010
tcp6 0 0 localhost:6010 localhost:39698 ESTABLISHED
tcp6 0 0 localhost:39698 localhost:6010 ESTABLISHED
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)?
I don't know any straighforward way to check that. I don't know about any X11 core protocol or extension request that returns the machine the X11 server runs on. You should do it step by step: first check if the X11 client is connected to a forwarder, then where it is forwarding the connection, etc.
Thanks. Whenever there is connection within the same host, is it always shown as two lines innestat
?
– Tim
Mar 15 at 21:26
Yes.netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.
– mosvy
Mar 15 at 22:08
add a comment |
Why is the connection between $DISPLAY on C and $DISPLAY on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
The X forwarding channel has not been yet created. It's only created when a client connects to the port 6010
on your C
(remote) machine. The connection will be forwarded as a separate channel through the ssh connection (not through a different tcp connection between C
and B
). To display all the channels forwarded through an ssh connection, you should use the ~#
escape at the beginning of a line:
$ ssh -X localhost
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
$ netstat | grep 6010
$ xterm &
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
#1 x11 (t4 r3 i0/0 o0/0 fd 8/8 cc -1)
$ netstat | grep 6010
tcp6 0 0 localhost:6010 localhost:39698 ESTABLISHED
tcp6 0 0 localhost:39698 localhost:6010 ESTABLISHED
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)?
I don't know any straighforward way to check that. I don't know about any X11 core protocol or extension request that returns the machine the X11 server runs on. You should do it step by step: first check if the X11 client is connected to a forwarder, then where it is forwarding the connection, etc.
Thanks. Whenever there is connection within the same host, is it always shown as two lines innestat
?
– Tim
Mar 15 at 21:26
Yes.netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.
– mosvy
Mar 15 at 22:08
add a comment |
Why is the connection between $DISPLAY on C and $DISPLAY on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
The X forwarding channel has not been yet created. It's only created when a client connects to the port 6010
on your C
(remote) machine. The connection will be forwarded as a separate channel through the ssh connection (not through a different tcp connection between C
and B
). To display all the channels forwarded through an ssh connection, you should use the ~#
escape at the beginning of a line:
$ ssh -X localhost
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
$ netstat | grep 6010
$ xterm &
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
#1 x11 (t4 r3 i0/0 o0/0 fd 8/8 cc -1)
$ netstat | grep 6010
tcp6 0 0 localhost:6010 localhost:39698 ESTABLISHED
tcp6 0 0 localhost:39698 localhost:6010 ESTABLISHED
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)?
I don't know any straighforward way to check that. I don't know about any X11 core protocol or extension request that returns the machine the X11 server runs on. You should do it step by step: first check if the X11 client is connected to a forwarder, then where it is forwarding the connection, etc.
Why is the connection between $DISPLAY on C and $DISPLAY on B LISTEN not ESTABLISHED, given that the X forwarding channel has been created?
The X forwarding channel has not been yet created. It's only created when a client connects to the port 6010
on your C
(remote) machine. The connection will be forwarded as a separate channel through the ssh connection (not through a different tcp connection between C
and B
). To display all the channels forwarded through an ssh connection, you should use the ~#
escape at the beginning of a line:
$ ssh -X localhost
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
$ netstat | grep 6010
$ xterm &
$ ~#
The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 fd 5/6 cc -1)
#1 x11 (t4 r3 i0/0 o0/0 fd 8/8 cc -1)
$ netstat | grep 6010
tcp6 0 0 localhost:6010 localhost:39698 ESTABLISHED
tcp6 0 0 localhost:39698 localhost:6010 ESTABLISHED
When I run a X client on C, how can I verify that it is connected to the X server on B (the local machine)?
I don't know any straighforward way to check that. I don't know about any X11 core protocol or extension request that returns the machine the X11 server runs on. You should do it step by step: first check if the X11 client is connected to a forwarder, then where it is forwarding the connection, etc.
edited Mar 15 at 22:06
answered Mar 15 at 15:02
mosvymosvy
10k11236
10k11236
Thanks. Whenever there is connection within the same host, is it always shown as two lines innestat
?
– Tim
Mar 15 at 21:26
Yes.netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.
– mosvy
Mar 15 at 22:08
add a comment |
Thanks. Whenever there is connection within the same host, is it always shown as two lines innestat
?
– Tim
Mar 15 at 21:26
Yes.netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.
– mosvy
Mar 15 at 22:08
Thanks. Whenever there is connection within the same host, is it always shown as two lines in
nestat
?– Tim
Mar 15 at 21:26
Thanks. Whenever there is connection within the same host, is it always shown as two lines in
nestat
?– Tim
Mar 15 at 21:26
Yes.
netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.– mosvy
Mar 15 at 22:08
Yes.
netstat
should show the local and remote ("foreign") adress of each local socket, and there you have two of them.– mosvy
Mar 15 at 22:08
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506488%2fhow-can-i-find-the-mapping-on-display-after-ssh-x%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown