LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Trying to tunnel X over SSH (http://www.linuxquestions.org/questions/linux-software-2/trying-to-tunnel-x-over-ssh-468135/)

DaneM 07-27-2006 02:51 AM

Trying to tunnel X over SSH
 
Hello, all.

I'm trying to tunnel X over SSH like this:

Code:

ssh -X dane@192.168.1.250
But it just puts me into a terminal on the remote machine, and when I try to start X, it tells me that, "Server is already active for display :0".

What am I doing wrong?

Thanks in advance.

--Dane

Nylex 07-27-2006 03:08 AM

You're not doing anything wrong, it's supposed to do that. Remember, SSH = secure shell. You can run graphical programs on the remote machine and they'll appear on your local machine, just enter the program name at the prompt as you would if you were running something from a terminal locally. If you need whole desktop access, I think you'll have to look into using VNC.

Electro 07-27-2006 03:16 AM

Go to http://www.tldp.org/HOWTO/XDMCP-HOWTO/ssh.html

spooon 07-27-2006 03:26 AM

Quote:

Originally Posted by DaneM
and when I try to start X, it tells me that, "Server is already active for display :0".

You don't want to start X on the remote machine; because that won't do any good (you are not sitting in front of the remote machine) and you already have X running on the local machine. The point is you want remote programs to talk to X on the local machine.

DaneM 07-27-2006 03:29 AM

Thanks for the replies!

I would ultimately like to have a full X session running like this, but I would like to also like to run individual applications instead of having to start the whole GUI (KDE/Gnome/XFCE/etc.).

When I ssh in and try to start "xclock", it says that it "failed to start on :0". If I export a different $DISPLAY value, it just says that it can't start on that display.

Any ideas?

--Dane

spooon 07-27-2006 03:40 AM

Quote:

Originally Posted by DaneM
When I ssh in and try to start "xclock", it says that it "failed to start on :0". If I export a different $DISPLAY value, it just says that it can't start on that display.

don't mess with $DISPLAY, just ssh in, and run it

TB0ne 07-27-2006 11:16 AM

Trying to tunnel X over SSH
 
Quote:

Originally Posted by DaneM
Thanks for the replies!

I would ultimately like to have a full X session running like this, but I would like to also like to run individual applications instead of having to start the whole GUI (KDE/Gnome/XFCE/etc.).

When I ssh in and try to start "xclock", it says that it "failed to start on :0". If I export a different $DISPLAY value, it just says that it can't start on that display.

Any ideas?

--Dane

On your local machine (where you're initiating the connection), execute "xhost <IP address of remote machine>" or "xhost +". The "xhost +" is fairly unsafe, and will let ANYONE start an X session on your local box.

This should allow the remote machine to fire up an X session (such as xclock or xlogo), on your local machine.

Another thing to check is to be sure your display manager is running and accepting XDMCP connections. Run a "ps -ef | grep dm", and look for your display manager (gdm, xdm, etc.). If you see it started with the --nolisten parameter, nothing will work. Your local X server isn't set up to accept incoming connections, period. I don't know what distro or DM you're using, so I can't suggest what to change to remove the --nolisten, if it's there.

Good luck.

haertig 07-27-2006 12:48 PM

Quote:

Originally Posted by TB0ne
Another thing to check is to be sure your display manager is running and accepting XDMCP connections.

This is not necessary if you're tunnelling the connection over ssh.

doublejoon 07-27-2006 01:05 PM

I did this for ubuntu.. works great! Occasionally I need to restart gdm but not a big deal

http://ubuntuforums.org/showthread.p...ighlight=xdmcp

DaneM 07-27-2006 04:06 PM

Thanks for all the replies!

I tried using "xhost 192.168.1.250" (the remote server's IP address), and "xhost +", but both give me the error,

Code:

xhost: unable to open display ""
Just for good measure, I ran "ps -ef | grep dm" on the server, and determined that kdm was not running with any options.

Thanks for posting the link to the How-To, doublejoon. Setting up a VNC server will probably be my next step once I manage to get single apps working.

I suppose some more information is in order. The server is running 64-bit Gentoo (fully-updated) with xorg 7.0 and XGL (using compiz). I am able to start up a non-XGL session, however, by running "startx". The client is running 32-bit Ubuntu-Dapper, also fully-updated.

I should probably also tell you all that basically, what I'm trying to do is to be able to administer the server (which also happens to be a desktop computer) remotely, such as from the other room, should the need arise (such as when I'm trying to do something on another computer at the same time). I'm hoping that once I get this working, it'll allow me to do it on other computers that I'll set up strictly as servers, so that I won't need to have a monitor attached to them in order to get at the tools I need.

Thanks again.

--Dane

DaneM 07-27-2006 11:09 PM

Hello again.

I just realized that I had missed one (obvious?) step: the X server wasn't running on my client box. Now I can run programs from the server on the Ubuntu computer!

Thanks for all our help; I'll probably move on to VNC next.

--Dane

lleb 07-28-2006 12:51 AM

just an FYI, VNC is slow no matter what the platform.

there are several thinclient type apps out there for linux that will give you a new xwindow on a remote system that are not near as laggy as vnc.

i do use x11vnc on one of my computers, but that is just because it is easy to not muck with much, but now that i have it hooked up to a HDTV i no longer use the x11vnc as i can read the screen on the TV clearly now vs when it was on a standard TV.

evilDagmar 07-28-2006 03:05 AM

Never, ever, use `xhost +`. This disables access control entirely for X.

DaneM 07-28-2006 03:15 AM

Thanks for the tips. I'm currently looking into FreeNX for performance reasons, and have only used "xhost +" for testing purposes. It's set back to defaults now.

Have a good one.

--Dane

fakie_flip 08-13-2006 12:15 AM

easy solution. dont let anyone tell you that you cant do it. login to a computer with ssh using X forwarding and type this command.

startx -- :1

You aleady have X running on :0 so you need to run X on :1


All times are GMT -5. The time now is 01:34 PM.