SSH X11 Setting the Display Variable
- From: Chris Mirchandani <novashadow@xxxxxxx>
- Date: Tue, 19 May 2009 20:08:59 -0400
Is there a way to have the DISPLAY variable set the way that sshd sets it when a clientconnects with either -X or -Y option, but after the shell loads? It would be best of thiscould only be done if the shell was started by an ssh session that used the -X or -Y option.
The specific ssh version in question is listed below, but I would like to have solutions fornewer versions of ssh as well.
OpenSSH_4.6p1 Debian-5ubuntu0.6, OpenSSL 0.9.8e 23 Feb 2007
This is the situation. I am running a coLinux based distro named andLinux, which basicallyis Ubuntu 7.04 running parallel with Windows. It has this "hack" that allows X forwardingover a virtual network interface that provides inter OS network between Windows and Linux.The X forwarding is used to load Linux X apps, Xfce based in this case, in Windows usingXming. To make this work, the following line is in /etc/profile.
Early on, I found that this prevented X forwarding to work when I sshed to andLinux via theopen network interface, the interface used to access other computers on my network andthe internet through my firewall. I got around this by adding the following to ~/.profile
This has 2 issues. The first is that I have to add this for each user. In this case that is nobiggie, but it would be great if I could override this for all users always. The second is oneI found today and that is because I have statically set this variable all ssh sessions use 10and that means that no-matter which ssh session I try to X forward in, the X app is sent tothe computer that crated the first ssh session that successfully had X forwarding set. Therub is that since andLinux "needs" the specific $DISPLAY setting set in /etc/profile, it isinherited by all shell sessions and it gets set after sshd sets this variable. This is a problemfor me as I may be connected from several places with x forwarding enabled. I know I canmanually set this, but that has 2 issues.
1) I have to set it every time.
2) The bigger issue is, I learn nothing by doing that.
So if I were to break down the parts of the $DISPLAY variable in to the following.
x = localhosty = 10z = 0
So I want to be able to set it so that $DISPLAY is set with a different y for each session thatsuccessfully creates an X forwarding session.
Any ideas or hints?
In case it helps.
uname -aLinux andLinux 126.96.36.199-co-0.7.3 #1 PREEMPT Wed Apr 16 18:50:10 UTC 2008 i686 GNU/Linux
# cat /etc/debian_version lenny/sid
# cat /etc/issue Ubuntu 7.10 \n \l
I have a new version of this andLinux, details below.
Hotmail® has a new way to see what's up with your friends.
- Prev by Date: Re: openssh make FAILS, any idea, here's the error text
- Next by Date: RE: openssh make FAILS, any idea, here's the error text
- Previous by thread: openssh make FAILS, any idea, here's the error text
- Next by thread: Re: SSH X11 Setting the Display Variable