Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-12-2008, 11:04 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 2

Rep: Reputation: 0
How do you run graphical programs on the server, displayed on the server, with ssh?

I've recently been teaching myself to use ssh, and so far it's going nicely, and I've set up key pairs and such things, but I want to be able to do more.

Executing commands is all very well, but sometimes I want to run a graphical program on the machine I'm sshing to (I think it's called the server), and have it displayed on that machine, rather than my own. (I think you display it on your own machine with the -X option.)

Thanks in advance for your help.
Old 10-12-2008, 12:00 PM   #2
john test
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
If you are on machine A and are SSHed into machine B
Go to Machine B and get to a command prompt and type "xhost +"
Then go back to machine A and from the SSH prompt type "export DISPLAY=:0.0
at that point you could type "xcalc &" and expect a display of xcalc on the screen of machine B
The trailing & releases the SSH for further use.
If you don't use the trailing & your SSH will still be connected to the gui and the keystrokes should cause the GUI application running on machine B to to respond to your keystrokes
Old 10-13-2008, 04:19 AM   #3
LQ Newbie
Registered: Oct 2008
Posts: 2

Original Poster
Rep: Reputation: 0
The keystrokes don't seem to translate to the other machine.

However, how do I set the display back to Machine A (like with the -X option), after I've done that?

Also, how would I be able to control this new window? VNC?
Old 10-13-2008, 03:38 PM   #4
john test
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
at ssh prompt type "export DISPLAY=MachineAipAddress:0.0 for example:
export DISPLAY=
that should work if you have xwindows running on Machine A
Old 10-13-2008, 04:04 PM   #5
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Rep: Reputation: 16
If you are looking to learn SSH, and have some fun, while including your Windows box in the loop of things... I suggest two tools, XMing and Putty.

XMing, is a neat little piece of software that listens for X11 requests on the Windows hosts, and renders the X11 graphics as needed. It basically mimics a true X11 server... It works quite well. I do suggest the use of SSH compression however.

Putty is the best FREE Terminal Emulator client for Linux, as far as I'm concerned... Portable Putty, is a spin off with a few additional features, that can be downloaded from the XMing website.

SSH will allow you to forward more than just X11 requests, you can forward ports, through a method known as SSH Tunneling... This is great for securing access to services such as POP3 & HTML based email accounts. Plus whatever else that you may need to secure.

Last but not least, you can take advantage of the port forwarding feature, between servers, including daisy chaining various ports together. For example, Server A forward to B who Forwards to C, and so on....

So when you connect to server A, on the specified port, you actually connection to Server C in this case...

Have fun, be secure...

Zimbra, your OSALT to Microsoft Exchange
Vyatta, your OSALT to CISCO....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
SSH connection in graphical mode (X-Server?) max2004 Linux - Networking 12 01-25-2012 05:19 AM
Trying to run an ssh server on a laptop behind a router... mtu mismatch? E-Man Linux - Wireless Networking 1 05-22-2008 12:05 PM
How to run programs at exiting the graphical desktop marozsas Linux - Desktop 2 08-16-2006 06:28 AM
Graphical Programs over ssh andrewguy9 Linux - Software 2 02-24-2005 08:30 AM
X-server on RedHat 9.0 not starting the following error is displayed !!! tuxindia Red Hat 1 02-10-2004 09:32 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 PM.

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