LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-04-2007, 09:40 AM   #1
xp_newbie
Member
 
Registered: Nov 2006
Posts: 86

Rep: Reputation: 16
Question ssh -X user@server works differently from two clients?


I have two Ubuntu 6.0.6 (Dapper) clients.
Both allow me to ssh -X to a Fedora Core 4 server.

However, only one of them allows me to display X programs on the client's display (i.e.. using the client as an X server).

I would like to make the second one work like the first one (allow X) but I have no idea how to start comparing/troubleshooting this - or where to look.

Back then, in the telnet & export DISPLAY= days, xhost+ would explain/solve such problems. Today however, I am lost.

Any clue/tip/direction on what to look for?

Thanks,
Alex
 
Old 04-05-2007, 08:28 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Can you open xterm on the bad client all by itself? (That is to say when you are at a command line prompt on the ubuntu client NOT after the ssh.) You'd first want to verify the client was capable of opening X sessions before troubleshooting the other end. It may be something as simple as not running X on the client in the first place.

When you DO ssh -X from the two clients what does "echo $DISPLAY" show for each of them?

Have you verified nothing in the login (bashrc, profile etc...) sets DISPLAY and overrides the tunnel DISPLAY you're trying to use?

Have you compared firewall (iptables usually) configuration of the two clients to see if there are differences?

Is either client running with SELinux enabled? Is the other?

Is there an internal router/firewall that needs to be configured?
 
Old 04-05-2007, 10:59 AM   #3
xp_newbie
Member
 
Registered: Nov 2006
Posts: 86

Original Poster
Rep: Reputation: 16
jlightner, thank you very much for your answer.

Quote:
Originally Posted by jlightner
Can you open xterm on the bad client all by itself? (That is to say when you are at a command line prompt on the ubuntu client NOT after the ssh.)
Of course. I do that all the time. In fact, I first open an xterm, then type ssh -X user@server.


Quote:
Originally Posted by jlightner
When you DO ssh -X from the two clients what does "echo $DISPLAY" show for each of them?
From the bad client: localhost:10.0
From the good client: localhost:11.0

(I ssh-ed from the good client, shortly I ssh-ed from the bad one and both have ssh sessions running concurrently. Could that explain the different numbers?)

Quote:
Originally Posted by jlightner
Have you verified nothing in the login (bashrc, profile etc...) sets DISPLAY and overrides the tunnel DISPLAY you're trying to use?
Huh??? The login is the same for both (after all it's the same exact server).

Quote:
Originally Posted by jlightner
Have you compared firewall (iptables usually) configuration of the two clients to see if there are differences?
Where do I check iptables configuration on Ubuntu? One of the beauties of Ubuntu is that it allows its users to be clueless about its inneworkings. I am currently in such state in certain areas. When I posted this same question on the Ubuntu forums, I got 0 responses, which may suggest that I am not alone...

Quote:
Originally Posted by jlightner
Is either client running with SELinux enabled? Is the other?
As far as I know, none of the clients is running with SELinux enabled (how do I verify that?)

Quote:
Originally Posted by jlightner
Is there an internal router/firewall that needs to be configured?
No.

Interestingly enough, after going through all these steps (not changing anything in the systems - just checking, of course), ssh -X now seems to be working identically on both clients! This is crazy. I have no idea what happened since I last posted my request for help. Could it be that I only have this problem if I "su" on the server? No - I just did "su" on the server (after ssh-ing from the "bad" client) and it let me invoke Emacs in X (running on the server but displayed on the client). This is crazy. I don't understand what's happening. I can swear that I did not imagine the problem.

Thanks,
Alex

Last edited by xp_newbie; 04-05-2007 at 11:02 AM.
 
Old 04-05-2007, 11:16 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you "su -" rather than just "su" it invokes the environment of root. "su" by itself keeps your original environment including the all important DISPLAY variable.

It isn't unusual to have things in $HOME/.profile or $HOME/.bash_profile or $HOME/.bashrc etc... that tries to set DISPLAY . However it does that based on your source IP address (or hostname assuming it has a way to determine the latter). This will override the DISPLAY that is created by the tunnel which as you see is actually "localhost" (127.0.0.1). Since this default type of DISPLAY isn't the one the tunnel opened it won't work.

Sometimes files will have lines that do something like:
if [ `tty -eq /dev/pts/0 ]
then export DISPLAY=myhost:0.0
fi

If so it would have overridden your DISPLAY even though you were the same user both times if you came in on /dev/pts/0 on the "bad" system but as /dev/pts/1 on the "good" system. However I don't think that happened to you - just explaining why I asked that question.

At command line if you have iptables you can run "iptables -L" to see its config. (The GUI for this is called Firestarter.)

SELinux isn't an issue since it works now.

I suspect your issue was the "su" vs "su -" thing above.

P.S. For most commands you can do "man <command>" or "info <command>" to get a lot of detail. On Linux info typically provides at least the man page and sometimes more detail. In UNIX only man is available.

So to get more information about iptables:
man iptables
-OR-
info iptables
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian: AWStats works differently when going to IP or hostname Punkrulz Linux - Software 0 01-13-2006 12:07 PM
SuSE works differently from Mandrake? escordeiro Linux - Newbie 1 09-30-2004 08:28 PM
Unable to access my ssh server and ftp server from the Internet, but smtp works foxone Linux - Networking 1 05-28-2004 05:17 PM
SSH how to configure differently for different cards (ie root access) datus Linux - Security 3 03-28-2004 02:48 PM
Win clients to AIX server SSH? Larsin Linux - Software 2 02-12-2004 02:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration