Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Friday, August 14, 2009

Importing a remote desktop session via ssh tunnel

At home I have, 2 machines, one running Ubuntu 9.04 (Jaunty) and the other running Ubuntu 8.04 (Hardy). The Hardy machine is used by my family members and I use Jaunty for my experiments. Some times, I would like to test some thing on Hardy also. But most of the times that machine is not free. I use ssh to login to the hardy box and use an ssh tunnel to export the GUI session back to my Jaunty box.

The steps I took are detailed below.

On Hardy box

1) Install open ssh server

$sudo apt-get install openssh-server

On Jaunty Box

2) I switch to a text terminal by pressing Control+ALT+ F2. (any thing from F1 to F6 will work)

3) Login to the text terminal

4) Start a new session on Virtual Terminal 8 and launch xterm on it.

$ xinit /usr/bin/xterm -- :1

( :1 above represents the virtual graphical display , you can also use :2 )

5) A gray screen with xterm will appear on virtual terminal 8. If it is not appearing you can switch to it by

$ chvt 8

Or by pressing Control+Alt+f8

6) Now ssh to the Hardy box with tunneling.

$ ssh -Y fermi@192.168.0.2

Give your credentials and login (The IP address above is that of my Hardy box, you can replace it with your user name and IP). You are now logged to Hardy. The GUI of any program launched on Hardy ( in this terminal) will be tunneled back to Jaunty via ssh.

7) Start a gnome session on Hardy by typing the following command in the xterm terminal.

$ gnome-session

You can start other desktop sessions like kde or xfce , if they are installed.