LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Suse/Novell (http://www.linuxquestions.org/questions/suse-novell-60/)
-   -   xterm will not display (http://www.linuxquestions.org/questions/suse-novell-60/xterm-will-not-display-377539/)

nanjil 10-27-2005 04:45 PM

xterm will not display
 
hello:

I have suse linux 10.0 installed in a machine. from that machine I rsh'd to my windows machine running cygwin.

I went through the usual procedure of setting display as the suse machine:0 and made sure to run xhost +.

but still i get the error message

xterm: can't open display

when I try to fire up a xterm in the remote machine

any ideas?
thanx

Quigi 10-28-2005 12:25 PM

What is "the usual procedure of setting display"? The error looks like it is NOT set.

For security, I'd use ssh instead of rsh.

There are many other issues:
* suse_machine:0 expects X to listen on :6000 as in the old days. Mine (Xorg Release 6.7) doesn't. What do you get from "sudo /usr/sbin/lsof -i :6000-6020 -P -n" on Suse?
* Your firewall may block :6000
* xhost + (if it works at all) is dangerous.
* ssh fails to tunnel X11 to Cygwin (Anyone know why?)

I worked around them. Let us know your situation.

nanjil 10-28-2005 07:34 PM

the sudo command lsof returns with nothing for ports 6000-6020.

My firewall is disabled as well.
I double checked the DISPLAY variabel in the remote cygwin client and it is set correctly

Quigi 10-28-2005 09:39 PM

As I said, normally you'd just "ssh otherhost", and all would working -- no need to xhost or set DISPLAY. But it doesn't work for Cygwin.

Your lsof result shows your X server acs like mine -- it's not listening. But you can use ssh's "normal" behavior to make it listen by logging in to a non-cygwin machine, e.g., localhost. There are two ways. One would actually make your DISPLAY environment variable work. The other seems a bit simpler.

Quigi 10-28-2005 10:18 PM

Here's how you could do it. Call me devious, or better yet, tell me a simpler way ;)
Code:

$ ssh localhost
quigi@localhost's password: not echoed
$ echo $DISPLAY
localhost:10.0
$ xauth l :10
susehost/unix:10  MIT-MAGIC-COOKIE-1  5ef1d2207b1be43321c4ea4e16df46bc
$ ssh cygwinhost -R6010:localhost:6010
quigi@cygwinhost's password:

Last login: Fri Oct 28 13:27:33 2005 from susehost
$ export DISPLAY=localhost:10
$ xauth add :10  MIT-MAGIC-COOKIE-1  5ef1d2207b1be43321c4ea4e16df46bc
$ xclock or xterm or whatever

Obviously you'd substitute the real host names or IP addresses for "susehost" and "cygwinhost". After the first ssh, you can run lsof again, and you'll see
Code:

COMMAND  PID  USER  FD  TYPE  DEVICE SIZE NODE NAME
sshd    25193 quigi    9u  IPv4 2430800      TCP localhost.localdomain:6010 (LISTEN)
sshd    25193 quigi  10u  IPv6 2430801      TCP localhost:6010 (LISTEN)

Now ssh is listening! For display :10, it's port 6000+10. If you omit the -P option, you get "x11-ssh-offset" instead. And we forward this very port to the other machine.

Note that "xhost" is not necessary. The "xauth" scheme, which hinges on keeping the magic cookie secret, is more modern and safer. It was developed for X servers, but in this case, ssh, which acts as a proxy for your non-listening X server, will check it.

spooon 10-28-2005 11:07 PM

Let me first get this clear, are you SSH'ing from Linux to Windows, or from Windows to Linux?

If it is the latter, in Cygwin, you need to first start the X server in order to get X. So you should first do "startx"; then you get an xterm. Then you can do "ssh -Y user@hostname", which is the correct way to forward X in OpenSSH (in Linux and other OSs), and don't do any xhost or change $DISPLAY or anything like that. (for older versions use "-X")

nanjil 10-29-2005 06:45 AM

okay

I will try that method (trying to display cygwin xterm in suse linux machine)

To throguh more light, this is my situation

I used to be developing code in a windows/cygwin environment in a laptop

now my plan is to make the suse linux in a desktop as the main code development platform.

During this migration I have to periodically log on to the cygwin laptop. During this migration It is still convenient to do emacs etc over in the cygwin laptop, yet have it displayed in the suse linux.

Yes i have the cygwin xterm running

thanx for your time and help

nanjil 10-29-2005 04:05 PM

guys

I just figured out the problem. the ssh server was not setup to forward X11.

I modified sshd_conf and now my remote cygwin is forwarding the xsession

thanx


All times are GMT -5. The time now is 06:20 PM.