X session over SSH from Windows box

Forum: LinuxTotal Replies: 27
Author Content
Steven_Rosenber

Feb 29, 2008
7:55 PM EDT
I've been using PuTTY from my Windows box to log in with SSH on my OpenBSD box. I'd like to do an X session over SSH. Can anybody recommend an app for my Windows box that will allow me to do this?
gus3

Feb 29, 2008
8:31 PM EDT
I suggest Cygwin with the X server package, but you'll need a fat pipe to download it. And a fair chunk of disk space.

If you have a working Java environment, and your remote programs aren't too heavy on the X protocol, WeirdX from JCraft is a possibility.
herzeleid

Feb 29, 2008
9:11 PM EDT
Replace your windoze box with some type of unix?
tuxtom

Feb 29, 2008
9:50 PM EDT
@Steven: Googling "vnc over ssh" brings up many interesting possibilities. Not sure if that is exactly what you're looking for but it seems like a well-trodden path.

Also found this: http://www.vanemery.com/Linux/XoverSSH/X-over-SSH2.html . I can't offer any specific advice...just trying to be helpful.
rijelkentaurus

Mar 01, 2008
3:41 AM EDT
NoMachine on the BSD box, NoMachine client on the Windows box....depends on the BSD box having Linux compatibility...and it would be a shot in the dark. I like it, however, and I use it to connect to Linux servers so that I can have a full graphical desktop. X over ssh is nice, but if it's not on the local network I find it to be painfully slow. VNC over ssh is probably slower. NoMachine is substantially faster than RDP.

nomachine.com
azerthoth

Mar 01, 2008
8:51 AM EDT
I have used xming in association with putty before with great success.

http://www.ece.uvic.ca/computing/win-xsessions.shtml http://gears.aset.psu.edu/hpc/guides/xming/
dinotrac

Mar 01, 2008
9:02 AM EDT
I've used xming, too, and I like it substantially more than Cygwin if all I want is an X server.
Steven_Rosenber

Mar 01, 2008
9:15 AM EDT
Thanks for the tips, everybody. It's going to be over the local network, so we'll see about speed. I've been wanting to try Cygwin for a while, but I think I'll start with Xming -- hadn't heard of the last one, so I'm glad to know about it.
tuxtom

Mar 01, 2008
12:34 PM EDT
Then again, Steven, herzeleid has a incredibly valid point. Even a VM solution might be a way to go, unless your workstation is not up to the task.

In some respects Cygwin is akin to putting a Band Aid on cancer. Why not go native?
Steven_Rosenber

Mar 01, 2008
4:04 PM EDT
I'm working in an environment filled with XP boxes that are pretty much going to stay that way. This at least is a bridge between the two. My job, at least, is changing in such a way that I'll be able to do more and more of my work in a Unix-like environment, be it Linux or a BSD. Especially in a business that relies heavily on specialty software written for Windows only, making a full transition to FOSS just isn't going to happen. Now that I'm making the transition from working on some print journalism and some Web to all Web, I'll probably be spending a lot more time not dealing with Windows. But that's just me .. not my nearly 100 other co-workers. ...
tuxtom

Mar 01, 2008
4:06 PM EDT
Been there myself plenty of times. You gotta do what you gotta do.
herzeleid

Mar 01, 2008
4:19 PM EDT
@steven_rosenber -

Man, I feel your pain.
Steven_Rosenber

Mar 03, 2008
11:52 AM EDT
OK, here's where I'm at. I managed to enable X over SSH in OpenBSD. I already had PuTTY, and I installed Xming. In Putty, I enabled X forwarding, and I can start any X application I want from the console, e.g.:

$ rox &

to run the ROX-filer.

So I can run any X app, and it opens in a window on my XP box.

But ... how do I get an X desktop? I want a window to open on my XP box that looks like my OpenBSD (or Linux, for that matter) desktop, with a window manager and all of that.

Doing this:

$ startx

starts an X session on the OpenBSD box's monitor, not on my XP box ... I can ctrl-C to end it ... and regain control of my PuTTY console.

Any ideas on getting a full X desktop over SSH?

p.s. thanks, everybody, for getting me this far.

krisum

Mar 03, 2008
12:07 PM EDT
something like startkde or gnome-session
tuxtom

Mar 03, 2008
12:27 PM EDT
Steven,

While I am no expert on X sessions, local or remote, I have read up on this a bit since you posted this. The methods of using a remote X session are not the same as having a remote desktop. The way it works is that you start an ssh session as a remote X session, and you can then run remote X apps on your X workstation. It does not give you remote control of a full GUI session as is the case with vnc.

local$> ssh -X host$> xeyes &

This will display xeyes on your local X desktop even though the app is running on the remote host (apparently it will also display in a window on your XP box). The remote host's sshd_config will need this line enabled: "X11Forwarding yes"

I found this in a little book I acquired called Linux Server Hacks by O'Reilly, First Edition. Hack #70, "X over ssh".

I hope this is helpful. After reflecting on the subject a bit it makes perfect sense. If you want a remote-control desktop vnc (or the like) is your answer. You will need to look into this, as well. Most vnc clients will not connect you to display:0, they start a new desktop session on display:1(+). You will need to use "x11vnc" to connect to the current X session running on the remote machine. I can verify this via experience.
Steven_Rosenber

Mar 03, 2008
1:12 PM EDT
I'm pretty happy for the moment to be able to run the console AND any X apps that I want. I had a few problems with Xming, but adding all the fonts solved that.

I'll have to try Cygwin next. That seems like quite a leap -- and a very powerful, complete product in its own right that bears investigating.

I wonder if now, with virtualization, running Cygwin is an anachronism, but since my grasp of what virtualization is all about is very, very tentative, I'll leave that for others.
tuxtom

Mar 03, 2008
2:49 PM EDT
There's many ways to skin a cat.

Your Putty/Xming setup is displaying remotely executing X apps on your desktop. It works...you can access remote GUI apps.

Cygwin provides a complete *nix environment running within the Windows OS as an application. I always found it very heavy and difficult to adjust to using, but it has been many years since I last tried it. It basically gives Windows OS a *nix shell and GNU utilities. I'm not sure how Cygwin will improve your remote-server work needs.

Virtualization (a.k.a. Virtual Machine) creates a virtual hardware PC upon which you would install any OS you choose...virtual BIOS and all, just like having another box. You put the CD in and teh VM will boot it and you do your install. The *nix would be running on an additional PC via emulated hardware. In your case, putty and Xming would be replaced by a native X display, but you would still not have a full remote desktop. It would work very similarly to the way putty/Xming already do for you.

VNC, etc., gives you remote control of the actual server console, so a person watching the physical console will see your mouse movements, etc. None of the previous three methods will give you this result.

Google is your friend. I'm sure there are many permutations of these points that have been successfully implemented in ways I'm not aware of.
tuxtom

Mar 03, 2008
2:58 PM EDT
---ignore...accidental overpost....
herzeleid

Mar 03, 2008
3:04 PM EDT
@ tuxtom -

> VNC, etc., gives you remote control of the actual server console, so a person watching the physical console will see your mouse movements, etc. None of the previous three methods will give you this result.

Eh? nobody sees anything of vnc on the physical console of a linux box when remote vnc sessions are in progress. In fact, the linux console can be running 80x25 text while multiple remote users have vnc X sessions running. Or you might have a local X login while multiple remote users have vnc sessions. Everything is isolated and protected and compartmentalized.

AFAIK the behavior you described does hold true, for ms and ms only.

tuxchick

Mar 03, 2008
3:21 PM EDT
It depends which VNC permutation you are using. There are a couple of "helpdesk" variants that attach to, and control an existing session. Both KDE and Gnome have nice little GUI clients for these. But most of them do like herzeleid said; the local user won't even know they're there.
tuxtom

Mar 03, 2008
4:00 PM EDT
A permutation which I previously mentioned is named "x11vnc". It allows you to connect to display:0 and actually have control of the active X desktop on the physical console. Most of the other vnc clients don't do this...they start a new X session on a new display (i.e. display:(n > 0) ).

I discovered this package after several initially frustrating attempts to help my father out remotely with his new Ubuntu Dell Laptop.

The 'x11vnc' package is available in the Debian and Ubuntu repositories.

Quoting:Both KDE and Gnome have nice little GUI clients for these.
This month's Linux Journal has a very nice article on just those.
jdixon

Mar 03, 2008
5:14 PM EDT
> But ... how do I get an X desktop?

Steven, just using startx & works for me from one Linux box to another, but I had to use ssh -Y to get it to work, so I wouldn't recommend it.

As others have suggested, I'd use VNC.
krisum

Mar 05, 2008
9:10 AM EDT
Steven,

Just curious to know if something like gnome-session/startkde/startxfce4 works to give a full X desktop? I have never tried that myself but should work over ssh.
thenixedreport

Mar 05, 2008
10:50 AM EDT
Steven,

I know this isn't quite what you had in mind, but you might give this one a try as well...

http://www.colinux.org/
Steven_Rosenber

Mar 05, 2008
10:51 AM EDT
with gnone-session &, I got three separate X session windows -- one for the desktop, two more for the upper and lower panels. It didn't really work that well. Something in my Xming setup makes it very hard to manipulate the windows when the full desktop is running. I can't make them small enough so I can easily use the rest of the stuff on my Windows desktop. And it's slow -- there must be a lot going on.

And while the upper panel did work -- and I could launch programs with it, those programs open up in their own Xming windows, so you don't really gain much -- except use of the menus -- by running the full GNOME desktop.

The lower GNOME panel appears, but it's blank and in the way of my Windows programs (and can't seemingly be moved).

And while the upper panel -- in its own window -- worked, the image of the upper panel also appeared with the main GNOME desktop ... so I had two upper panels, one working, the other not ... and with the desktop being not particularly responsive, there's not much reason to have it.

So it does work -- running a full GNOME desktop over ssh -- but not too well. If I could somehow keep my Linux desktop session in a smaller window, that would be much better.

All you really gain is the ability to use the GNOME menus to launch programs instead of the console.

And I pretty much had to kill the X server to end the session, so again, it's not the optimal way to do this. But starting individual X apps from the console and running them in Xming windows is working quite well.
tuxtom

Mar 05, 2008
11:11 AM EDT
Quoting:starting individual X apps from the console and running them in Xming windows is working quite well.
I would stick with that if you are getting your work done. If you really need the full desktop then why not just use vnc?
krisum

Mar 05, 2008
11:31 AM EDT
Steven,

Thanks for sharing your experience. Are you using muti-window mode of Xming? If yes, then using single-window mode might help solve some of those issues. For speed issue you could try ssh with compression (ssh -C) if it helps -- putty must have something to turn on compression.
thenixedreport

Mar 05, 2008
12:05 PM EDT
Hmm..... VNC might be your best bet then.......... OR!

Host system runs a *nix system with VMWare Server running an instance of Windows. :)

Or a combination of VirtualBox and VNC. :)

You cannot post until you login.