Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] How is "DISPLAY" env variable set when using SSH?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 653
Location: San Diego, CA

PostPosted: Wed Mar 02, 2011 2:43 am    Post subject: [Solved] How is "DISPLAY" env variable set when us Reply with quote

I just noticed that when I SSH to my machine with "ssh -X gentoo_server", then the environment value for "DISPLAY" is magically set to "localhost:10.0". If I open another SSH session without closing the first one, "DISPLAY" is set to "localhost:11.0".

That's all fine and dandy, because all my X apps work correctly no matter which terminal I run them from. I'd like to know how "DISPLAY" set with correct values. I mean, does "gentoo_server" keep track of how many sessions I have open and assign different values for "DISPLAY"?
__
sol


Last edited by solamour on Wed Mar 02, 2011 11:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2277
Location: Bardowick, Germany

PostPosted: Wed Mar 02, 2011 10:42 am    Post subject: Reply with quote

The server does it on its own:
http://www2.lns.mit.edu/compserv/security/ssh.html#x11 wrote:
If you enable X11 forwarding and you ssh to a remote host, ssh will set the DISPLAY environment variable to something like DISPLAY=remotehost:11.0. All X11 applications which you start on remotehost will connect to the X11 port remotehost:11.0. SSH will then forward all X11 traffic to your local display using the encrypted link between the hosts.
Edit: And yes, the ssh server keeps track of this.
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 653
Location: San Diego, CA

PostPosted: Wed Mar 02, 2011 11:24 pm    Post subject: Reply with quote

That says it all. Thank you for the clear explanation.
__
sol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum