LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   can't run applications remotely using export DISPLAY and xhost + (https://www.linuxquestions.org/questions/slackware-14/cant-run-applications-remotely-using-export-display-and-xhost-491526/)

nass 10-11-2006 03:12 PM

can't run applications remotely using export DISPLAY and xhost +
 
hi everyone,
im on two slackware pcs and i have a LAN. i am loging onto pc1 with ssh. and doing on that pc
export DISPLAY=pc2:0.0 .. pc2 is where i am sitting now...
then on pc2 im doing xhost + (to simplify things) ..
then i try to run xlogo or xload from pc1 so that it will pop up in pc2 monitor...
but it tells me it can't connect to the display...
what haven't i don yet?
what configurationm files are involved so that i can go check them?
thank you for your help
nass

Alien Bob 10-11-2006 03:31 PM

Do the computers know what IP address pc1 and pc2 have? Did you setup the /etc/hosts file with mappings of the host names to IP addresses?

What does
Code:

ping pc2
tell you if you run that on pc1?

Eric

nass 10-12-2006 06:01 AM

they both 'see' each other when i ping them. and either way im only using numeric ip addresses at this stage .. no names involved. pc1 and pc2 are names that fit in conviniently in writing this thread... (since i tend to mix up the client and server pc's lol)


so no that can't be it...

tronayne 10-12-2006 06:29 AM

In ~/.ssh on pc1, create a file named config and put an entry in it like this:
Host pc2
ForwardX11 yes
Compression yes
Protocol 2,1
User userid

Host *
ForwardX11 no
Compression yes
Protocol 2,1
The first entry allows pc1 to run applications on pc2 with display on pc1's screen. The second is the "blanket" entry for not permitting when connecting to machines outside your LAN. Do the same thing on pc2, changing "pc2" to "pc1" in that file.

A config file like this in ~/.ssh overrides system-wide settings (and makes life simpler).

It would be useful, while you're at it, to put entries of this form in /etc/hosts
# For loopbacking.
127.0.0.1 localhost
192.168.1.10 pc1.com pc1
192.168.1.20 pc2.com pc2

Then you won't have to use numeric addresses.

nass 10-13-2006 05:17 AM

i have already tweaked /etc/ssh/ssh_config and sshd_config
and uncommented in them both 'X11forward yes' and Host * (i believe that this means all hosts are allowed X11fwd).

do u really think i should put a config in ~/.ssh ?

nass

billstclair 10-13-2006 05:55 AM

I don't know how to enable the general ability of opening a window on PC1 from PC2, but I DID just learn that with your setup, ForwardX11 enabled in PC1's ssh_config for Host including PC2, and ForwardX11 enabled in PC2's sshd_config, it works for me to connect to PC2 from PC1 via ssh, with the -X parameter, and then start an X application. I also did "xhost localhost" on PC1.

Here's an example connecting to Slackware 11.0 on my desktop machine from Puppy 2.10 on my laptop:

Code:

# ssh -X wws@desk
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Fri Oct 13 06:40:43 2006 from lap
Linux 2.4.33.3.

I bet you have fun chasing the soap around the bathtub.
                -- Princess Diana, to a one-armed war veteran during
                  a visit to a London veterans hospital

wws@slackcraft:~$ echo $DISPLAY
localhost:10.0
wws@slackcraft:~$ xterm
Warning: Cannot convert string "nil2" to type FontStruct
wws@slackcraft:~$

An Xterm window popped up on my laptop.

The secret is "ssh -X"

I have used X-window servers on Windows and Unix machines that allow opening an X window through a telnet or rlogin session, but I haven't yet learned how to do that. No need, really, an encrypted ssh tunnel is much more secure.

tronayne 10-13-2006 07:49 AM

Quote:

Originally Posted by nass
i have already tweaked /etc/ssh/ssh_config and sshd_config
and uncommented in them both 'X11forward yes' and Host * (i believe that this means all hosts are allowed X11fwd).

do u really think i should put a config in ~/.ssh ?

nass

On PC2, try editing /etc/ssh/sshd_config and set these (they're at the bottom of the file); you don't need -- or want -- to mess with any other settings in that file:
X11Forwarding yes
X11DisplayOffset 10
You'll need to stop and restart sshd:
/etc/rc.d/rc.sshd stop
/etc/rc.d/rc.sshd start

Then, on PC1, enter
ssh PC2 /usr/X11R6/bin/xclock

and you should see the clock.

You really don't want "Host *" in /etc/ssh/sshd_config, do that in the per-user config (in ~/.ssh) to restrict unknown hosts from running X applications from your box if they're logged in as "you" (whoever "you" may be). That per-user config file works along with the system-wide configuration on a user-by-user basis and, when you've done the above along with ~/.ssh/config you should be able to simply execute a command on the remote machine as the example xlock above.

So, yeah, you probably should put the config file in ~/.ssh (and repeat the same thing on PC1 so PC2 can execute things).

nass 10-14-2006 05:25 AM

solved
 
i finally managed..
no i didn't do it with ssh -X even though i guess you managed to do that for me:)
what i did , in /etc/X11/xdm/ :

file Xaccess, uncomment lines (shown uncommented already):
* #any host can get a login window
and
* CHOOSER BROADCAST #any indirect host can get a chooser

file xdm-config, comment line (shown commented already):
!DisplayManager.requestPort: 0

and in /opt/kde/share/config/kdm:
file Xaccess, uncomment lines (shown uncommented already):
* #any host can get a login window
and
* CHOOSER BROADCAST #any indirect host can get a chooser

file kdmrc, make sure:
[Xdmcp] #look for this section and put Enable to TRUE if its not
Enable=true
Port=177

[X-:*-Core] #look for this section and Comment...
#ServerArgsLocal=-nolisten tcp

then by using the export DISPLAY=... and xhost + in the 2 pcs it should work fine

i basically got all this steps from this very good HOW-TO:
http://www.tldp.org/HOWTO/XDM-Xterm/config.html

nass


All times are GMT -5. The time now is 03:35 AM.