Sunday, June 28, 2009

Using ssh to access GUI program on a remote machine

Suppose you have two machines A and B . Let the ip addresses for A and B be a.a.a.a and b.b.b.b respectively. We will try to run gedit on B and get the graphical output on A. I am assuming both machies are ubuntu 9.04 Jaunty. This will work on other flavours of Linux too.

Install openssh server on machine B.
$ sudo apt-get install openssh-server

In Ubuntu ssh server will be started automatically. If not start it

$ sudo /etc/init.d/sshd start

Now you can connect to B from A

$ssh username@b.b.b.b

username will be user of system B.

When you do this for the first time , you may be asked to type yes/no to add the finger print of the remote machine. Now enter the password and you are done.

You can execute normal shell commands on machine B now.


$ssh -X username@b.b.b.b

will also allow you to take GUI control.

Try running gedit on the remote machine. The GUI will come on your local machine.

No comments: