Click to See Complete Forum and Search --> : ssh, X, and export DISPLAY
otbibb
11-13-2002, 01:37 PM
Hi friends,
I have spent all morning networking my office computer with my laptop on the same school network. I've learned how to ssh, scp, and sftp. And, I mounted my office computer file system onto my laptop using NFS. The thing that is still troubling me is exporting my host X display to the client (laptop)
On both computers, I set /etc/ssh/ssh_config to ForwardX11 Yes. My process is this:
ssh user@host.ip.#
password for user@host.ip.#
export DISPLAY=client.ip.#:0.0
When I try Xclock, I get "can't open display client.ip.#:0.0. If I export DISPLAY=localhost.localdomain:0.0, I can successfully start Xclock on the host, but nothing displays on the client. This is with X already running on the host, of course. If it isn't running, I can start KDE on the host (with the export to localhost), and I see all of the messages, but have no window display. ALT-F7 does nothing.
Any ideas about where I may have strayed from the true path?
This is in anticipation of setting up an old P100 laptop as an X terminal for running my office apps on an outdated laptop... joy!
Thanks in advance,
BB
bskahan
11-13-2002, 02:16 PM
try it without exporting DISPLAY, current ssh versions figure it out on their own.
hlrguy
11-13-2002, 02:41 PM
You have to xhost + on the computer where the remote display is being sent to. This may not be the only problem, but it is required since usualy, xhost blocks all connections.
On laptop,
xhost + <remote machine ip>
hlrguy
otbibb
11-13-2002, 03:06 PM
Well, this is getting interesting.
Using these helpful examples, I am able to do this:
xinit
xhost +host.ip.#
ssh host.ip.#
export DISPLAY=client.ip.#
Then, I can run xclock, fluxbox,etc. I even started a KDE session. It ran pretty slow, perhaps because I was already running one on the host computer, and the machine only has 128MB of RAM.
My question is, is there a way to get this to work without initializing an X session on the client computer?
Also, I've seen lots of people using VNC. Does this run faster than exporting a display over SSH? If I can get VNC to work, I am going to totally freak my in-laws out this weekend when I connect to the Slack box in my office on their WinXP via cable modem! I can see it now... "You're doing what?!? What happened to the Start menu?"
BB
hlrguy
11-13-2002, 06:03 PM
Are you using Dialup? If so, stick with direct remote display. I do use VNC, but only for the appications that are simply impractical to remote display. (Frame Maker). VNC is simply a desktop, with all programs running on the server, and therefore, you can start them, disconnect, reconnect and the session remains stable.
When running VNC, make the window as small as is reasonable. Where possible I use 800X600 with 8 bit color. Undortunately, when using Frame, I need to be 1200X1024 with 16 bit color, which means a 2-3 second lag time and about 20 seconds to refresh the screen when I switch desktops. That said, I would try both. (I get 52K each dialup, so if you don't get that, it will be slower)
Also, if you can DISABLE the login gui (set the server machine to runlevel 3), then you can install dxpc on the server, start it, then connect to it with the client dxpc session. I GREATLY increases the speed of remote display (Differential X Compression). It does not survice dialup however, and needs to be restarted each time you connect. I have automated the process of restarting dxpc with scripts. So it is fairly trivial for me now. My remote test tools go from 1-3 second delay to almost impreceptible lag time.
Oh yeah, in answer to your question...my workatation at work has not had an X session running for 4 years. Runlevel 3 is all you need to ssh and start processes.
hlrguy
http://www.vigor.nu/dxpc/
bastard23
11-14-2002, 01:09 AM
otbibb,
You are NOT getting encryption on you X programs. bskahan is correct, ssh should be setting up a DISPLAY var. What you are running is the standard X protocol over your link. Which is fine if you trust the network. You shouldn't have to mess with any of the X authentication programs (xauth, xhost)
If you WANT ENCRYPTION, don't set the DISPLAY var. ssh should set it to something like hostip:10.0. What it does is sets up a virtual X connection that the X programs on "host" talk to. ssh then tunnels it to your computer "client" and gives it to the local Xserver.
Xclient (xclock) -> sshd (DISPLAY=<host of sshd>:10.0) -> network -> ssh -> Xserver(DISPLAY=client:0.0)
Everything inbetween sshd and ssh is encrypted.
If you just want remote X programs, then your fine. But your giving up the benifits of ssh. You can also tunnel VNC over SSH. Here is the FAQ (http://www.uk.research.att.com/vnc/sshvnc.html). VNC might have a secure version now. And if it is a slow link, try using ssh -C for compression (gzip.)
Sorry for the caps, but I didn't want anyone to think they were using encryption when they weren't.
Hope that helps,
chris
otbibb
11-14-2002, 01:48 PM
Thank you Chris and hlrguy... These posts are really helping me out.
I did try VNC over dialup last night, but just for kicks. I am mainly going to use this for using my laptop on the schools LAN, while I am connected at school (via WAN). I trust the network more than the internet, but I'm sure we have CS students sniffing around for vulnerabilities in the system... I'd hate for my grade sheet to get changed (a la Ferris Buehler!).
So, I would rather be using SSH, and have SSH set up the X transfer, as you describe. I still have a problem somewhere in the display settings. When I SSH into the host and try to run an X program, I get "Error: Can't open display:" This is the same whether I'm running X on the client or not. (started with xinit).
If SSH is supposed to take care of the X forwarding, then I must have a mistake somewhere in the SSH config file. I have ForwardX11 turned on, which seems like it should do it.
Thanks, guys.
Bryan
bastard23
11-14-2002, 08:04 PM
otbibb,
Make sure your /etc/ssh/sshd_config file has X11Forwarding set on your host computer (sshd.) Mine has:
X11Forwarding yes
X11DisplayOffset 10
Good Luck,
chris